Continuing indentation
Marko Rauhamaa
marko at pacujo.net
Thu Mar 3 14:36:57 EST 2016
Rob Gaddi <rgaddi at highlandtechnology.invalid>:
> Not ugly, error-prone. The first is purely aestehetic, the second
> actually matters. Let something as simple as a trailing space sneak in
> after your backslash and your meaning changes. Blank line between;
> same thing.
Never been bitten by that.
Now, trying how emacs' indentation would react to such a syntax error, I
notice:
if some_condition \
and some_other_condition \
and some_final_condition:
play_bingo()
The misalignment is a surefire way to notice something is fishy (in all
programming languages).
> But the principle remains. Syntactic whitespace has its ups and downs
> on the leading edge of the line, but at least it's visible there. On
> the trailing end of the line it's actively inviting trouble in for
> coffee and eggs.
Continuation lines with backslashes are all over the place: make, bash,
C, Python. I can't remember such accidents taking place.
Now, *leading* whitespace causes all kinds of mischief including jagged
diffs and syntax errors.
Marko
More information about the Python-list
mailing list