New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank lines in Multiple Files lesson break indentation (with fix) #68

Open
janetriley opened this Issue Apr 25, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@janetriley
Contributor

janetriley commented Apr 25, 2015

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.

@janetriley janetriley changed the title from Blank lines in Multiple Files lesson break indentation to Blank lines in Multiple Files lesson break indentation (with fix) Apr 25, 2015

@tbekolay tbekolay added this to the Version 5.3 milestone Apr 28, 2015

@tbekolay

This comment has been minimized.

Contributor

tbekolay commented Apr 29, 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 %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?

@janetriley

This comment has been minimized.

Contributor

janetriley commented Apr 29, 2015

for loop with blank lines

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.

@iglpdc

This comment has been minimized.

Contributor

iglpdc commented Apr 29, 2015

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

@gvwilson

This comment has been minimized.

Member

gvwilson commented Apr 29, 2015

@tbekolay tbekolay removed this from the Version 5.3 milestone May 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment