Open janetriley opened 9 years ago
Can you be a bit more specific about what breaks in IPython? I feel that these blank lines are important for readability. It's true that they make it a bit more difficult to copy/paste, but I'm not sure if we want to encourage copy/pasting anyhow. At least, when I teach these lessons I have students type the lines in, to get the muscle memory of writing Python code.
For those reading this online after the fact, there is a %paste
magic in IPython... if you've copied something from a website, going into the IPython terminal and typing %paste
will give a better result than Ctrl+v. It's not a very obvious or well advertised feature though, so perhaps we should add something to the lessons or at least the instructor guide that notes that %paste
exists?
The blank line resets the indentation, so the "data = ..." line isn't part of the loop.
I agree that spaces make it more readable.
The tradeoff is branching into a discussion about indentation or %paste, which is important but not part of the current topic. Also, anyone working through the material on their own won't see why it's broken.
It's not a very obvious or well advertised feature though, so perhaps we should add something to the lessons or at least the instructor guide that notes that %paste exists?
Yes to add it to the instructor guide. It would be nice including also other shortcuts/magics for the notebook (I learnt in my last workshop how to indent a block of code, but I forgot the trick already...)
I'm -1 on putting more about the notebook in the core lessons, since
many people teach Python without using the Notebook. Instead, can it go
in discussion.md
for now?
In "Analyzing Data from Multiple Files" python-novice-inflammation/04-files.md line 52 there's a long script for looping through files and showing three plots.
The script includes blank lines for readability. The blanks mess up the indentation when the script is run in ipython. The for loop prints three filenames, then executes subsequent lines once.
Please see my pull request.