Comments (13)
I broke out the Jupyter notebooks discussion into its own issue, #39, so we can keep this thread specific to teaching whitespace and code blocks.
from pycar.
This was something folks in our room really struggled with too. Definitely worth thinking about for the next iteration.
from pycar.
Agreed. I don't know if we have to go full "tokenization" on them, but figuring out some clever way to do this would be good.
from pycar.
Our group just didn't understand the importance of whitespace and indentation. We had a hard time getting them to understand why not indenting things under loops broke their code, for instance.
Also, the tabs vs. spaces conversation was confusing for a lot of people.
from pycar.
Closed because the explanation was good enough?
from pycar.
Yeah, why is this closed?
from pycar.
Doh. Sorry. That was an accident. I think I was typing a comment then got distracted and hit the wrong thing.
from pycar.
Do we have a sense of why people don't understand indentation? Is it that people are so used to seeing more obvious delimiters, braces, open/close tags (in the case of markup), etc.? Or is it that people just don't fundamentally understand the concepts of blocks and scope? I suspect the latter. Maybe a simple early introduction to code blocks is in order, probably without getting into the gory details of scoping just yet. This early on, it should suffice to say that things happen in blocks of code and the interpreter needs a way to identify those blocks. Maybe actually drawing blocks around code would help visualize the idea. Maybe showing this visualization next to a similarly visualized Javascript example would be helpful for people to see that indentation serves the purpose that braces do in other languages.
from pycar.
I honestly think what really throws people off is the four-space / tab thing — they mix the two without even realizing it and then are bogged down with IndentErrors.
from pycar.
@scott2b, most of the PyCAR attendees have worked extensively with Excel and SQL but generally don't have much experience with coding in any language.
I think a lot of the problem is that they have a hard time at first realizing that spacing matters, and there is a difference between a line of code that begins with 2 spaces and 4, just as there is a difference between a line of code that ends with a colon versus one without.
I like Scott's idea about tracing code blocks a lot. Let's keep that in our back pocket, and if we find the class stumbling on the indentation issue, we can take a breather and have them trace the code blocks in front of them to see what gets executed together. As Scott said in a separate conversation, consistency is the key here, and we can preach about consistency and the best practices of the community (4 spaces forever!) throughout the day.
from pycar.
Now having been through this, I can see that that the problems with whitespace are greatly exacerbated with a copy-paste shell/interpreter approach to teaching. I really recommend that we move away from this workflow. Nearly all of the problems I fielded through the day were some sort of whitespace/formatting copy-paste issue or scoping/availability issues due to things being pasted out of order or re-pasted or finally a lack of understanding that doing something like pasting a function does not inherently execute that function. All of these issues would go away if students were executing scripts instead of working directly in the interpreter, and the bonus is that whitespace formatting would be much more clear.
Since notepad was the editor of the day, I'm not really sure much can be done about tabs-vs-spaces. I don't know if notepad has a soft-tabs option - but I'm kind of doubting it.
I think ipython/jupyter notebooks might be the right solution here. I am not well versed enough to know for sure, but I saw this used to success in other sessions, and some of the feedback I got from one of our own students was that he felt this approach used in another session was much better than the interactive interpreter approach.
from pycar.
I see that Cezary has followed up his comments to me directly with a post on PythonJournos: https://groups.google.com/forum/#!topic/PythonJournos/1wnfJeiVTmI
from pycar.
Strangely, this issue didn't really come up at all this year. Perhaps the Jupyter notebook and the way it auto-indents loops and conditionals with four spaces helped mitigate this issue.
I'll close this issue for now. If anyone wants to continue the discussion, please feel free to re-open.
from pycar.
Related Issues (20)
- Change basics to include if statements HOT 1
- Tweak ending to solitaire example HOT 3
- sort dataframe before deduplicating HOT 1
- freshen the README and schedule with info for 2019 HOT 2
- what's the deal with the API section in Project 2? HOT 6
- Add newline='' argument to open? HOT 2
- What can be better next year? HOT 3
- Ducks HOT 2
- Set up custom GitHub codespace HOT 1
- Update requirements.txt and PipFile if needed
- Sprinkle in more hands-on exercises
- Add disclaimer that Project #2 no longer works HOT 1
- Prune Project #2
- README.md - remove/simplify machine setup instructions?
- README.md - Modernize the Help! section
- Review/test The Basics HOT 1
- Review/test Project 1
- Review/test Project 3
- Create basic teacher's guide?
- Update project 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycar.