Join GitHub today
Blank lines in Multiple Files lesson break indentation (with fix) #68
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.
referenced this issue
Apr 25, 2015
changed the title from
Blank lines in Multiple Files lesson break indentation
Blank lines in Multiple Files lesson break indentation (with fix)
Apr 25, 2015
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
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.
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...)