GithubHelp home page GithubHelp logo

Comments (13)

tommeagher avatar tommeagher commented on September 2, 2024 1

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.

tommeagher avatar tommeagher commented on September 2, 2024

This was something folks in our room really struggled with too. Definitely worth thinking about for the next iteration.

from pycar.

rdmurphy avatar rdmurphy commented on September 2, 2024

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.

hbillings avatar hbillings commented on September 2, 2024

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.

chrislkeller avatar chrislkeller commented on September 2, 2024

Closed because the explanation was good enough?

from pycar.

tommeagher avatar tommeagher commented on September 2, 2024

Yeah, why is this closed?

from pycar.

rdmurphy avatar rdmurphy commented on September 2, 2024

Doh. Sorry. That was an accident. I think I was typing a comment then got distracted and hit the wrong thing.

from pycar.

scott2b avatar scott2b commented on September 2, 2024

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.

richardsalex avatar richardsalex commented on September 2, 2024

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.

tommeagher avatar tommeagher commented on September 2, 2024

@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.

scott2b avatar scott2b commented on September 2, 2024

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.

scott2b avatar scott2b commented on September 2, 2024

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.

tommeagher avatar tommeagher commented on September 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.