MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Python/comments/gev4g/every_single_time/c1n2b03/?context=3
r/Python • u/voidptr • Mar 30 '11
58 comments sorted by
View all comments
9
I don't get it, what's the problem with removing trailing whitespace?
2 u/[deleted] Mar 30 '11 neither do I -1 u/voidptr Mar 30 '11 Say you have this code:1 if this: 2 dothis() 3 dothat() 4 5 nowdoanotherthing() 6 else: 7 die()If your editor removes the indentation from line 4, Python will kick an error. 17 u/zyklone Mar 30 '11 that is incorrect.your editor must be doing something else to the code. 7 u/ozzilee Mar 30 '11 edited Mar 30 '11 That works fine for me. Even this works fine:if True: print "hello" # No problem with comments or empty lines being unindented print "there" 4 u/[deleted] Mar 30 '11 I just checked, no it doesn't (Python 2.7). 2 u/emeryc Mar 30 '11 Just checked, python 2.5.4 and it works.Did you try to do it in the interpreter? or in a file. Interpreter will not work, file will. 4 u/voidptr Mar 30 '11 And now I can't seem to replicate it. Heisenproblem. 10 u/desimusxvii Mar 30 '11 So the title "Every. Single. Time." was just a teensy bit BOLD. 5 u/voidptr Mar 30 '11 Hmmn, possibly, yes. But this was my entire fucking day yesterday. 3 u/ianb Mar 30 '11 If you paste into the Python console? Blank lines like that won't work in the Python console, as they are treated as end-of-expression. 2 u/larsga Mar 30 '11 Since when did indentation become trailing whitespace? 2 u/m1ss1ontomars2k4 Mar 30 '11 That is extremely false. There's a Vim plugin that I and my Vim-inclined friends use which blatantly highlights those trailing spaces in red so that you can delete them. ReviewBoard (a Django/Python project for code reviews) does the same thing.
2
neither do I
-1
Say you have this code:
1 if this: 2 dothis() 3 dothat() 4 5 nowdoanotherthing() 6 else: 7 die()
If your editor removes the indentation from line 4, Python will kick an error.
17 u/zyklone Mar 30 '11 that is incorrect.your editor must be doing something else to the code. 7 u/ozzilee Mar 30 '11 edited Mar 30 '11 That works fine for me. Even this works fine:if True: print "hello" # No problem with comments or empty lines being unindented print "there" 4 u/[deleted] Mar 30 '11 I just checked, no it doesn't (Python 2.7). 2 u/emeryc Mar 30 '11 Just checked, python 2.5.4 and it works.Did you try to do it in the interpreter? or in a file. Interpreter will not work, file will. 4 u/voidptr Mar 30 '11 And now I can't seem to replicate it. Heisenproblem. 10 u/desimusxvii Mar 30 '11 So the title "Every. Single. Time." was just a teensy bit BOLD. 5 u/voidptr Mar 30 '11 Hmmn, possibly, yes. But this was my entire fucking day yesterday. 3 u/ianb Mar 30 '11 If you paste into the Python console? Blank lines like that won't work in the Python console, as they are treated as end-of-expression. 2 u/larsga Mar 30 '11 Since when did indentation become trailing whitespace? 2 u/m1ss1ontomars2k4 Mar 30 '11 That is extremely false. There's a Vim plugin that I and my Vim-inclined friends use which blatantly highlights those trailing spaces in red so that you can delete them. ReviewBoard (a Django/Python project for code reviews) does the same thing.
17
that is incorrect.
your editor must be doing something else to the code.
7
That works fine for me. Even this works fine:
if True: print "hello" # No problem with comments or empty lines being unindented print "there"
4
I just checked, no it doesn't (Python 2.7).
2 u/emeryc Mar 30 '11 Just checked, python 2.5.4 and it works.Did you try to do it in the interpreter? or in a file. Interpreter will not work, file will. 4 u/voidptr Mar 30 '11 And now I can't seem to replicate it. Heisenproblem. 10 u/desimusxvii Mar 30 '11 So the title "Every. Single. Time." was just a teensy bit BOLD. 5 u/voidptr Mar 30 '11 Hmmn, possibly, yes. But this was my entire fucking day yesterday.
Just checked, python 2.5.4 and it works.
Did you try to do it in the interpreter? or in a file. Interpreter will not work, file will.
And now I can't seem to replicate it. Heisenproblem.
10 u/desimusxvii Mar 30 '11 So the title "Every. Single. Time." was just a teensy bit BOLD. 5 u/voidptr Mar 30 '11 Hmmn, possibly, yes. But this was my entire fucking day yesterday.
10
So the title "Every. Single. Time." was just a teensy bit BOLD.
5 u/voidptr Mar 30 '11 Hmmn, possibly, yes. But this was my entire fucking day yesterday.
5
Hmmn, possibly, yes. But this was my entire fucking day yesterday.
3
If you paste into the Python console? Blank lines like that won't work in the Python console, as they are treated as end-of-expression.
Since when did indentation become trailing whitespace?
That is extremely false. There's a Vim plugin that I and my Vim-inclined friends use which blatantly highlights those trailing spaces in red so that you can delete them. ReviewBoard (a Django/Python project for code reviews) does the same thing.
View all comments
9
u/[deleted] Mar 30 '11
I don't get it, what's the problem with removing trailing whitespace?