[ home | blog home | recent activity ]
I use a four space indent which causes problems when indenting
if statements that span multiple lines. For
example:
if (a
and b
and c):
if_block_here
The problem is caused because if is two characters
and therefor if ( is four characters--which matches
the four space indent. I end up with code where I can't easily
distinguish if statement from the if block.
After talking about it with Paul and Chris and working out what the specifics of the problem are, I decided to use double parens. The above with double-parens looks like this:
if ((a
and b
and c)):
if_block_here
That satisfies PEP-8, doesn't change the semantics, and fixes my problem. It is a little goofy to use double parens, but it's a good enough fix until I get around to fiddling with the code that does automatic indentation in python-mode.
I'd be interested in other ideas that don't involve using \
at the end of lines if they're out there.
Comments:
Post a new comment:
Three things:
If you can't for some reason post a comment, send me an email: willg at bluesock dot org.
pyblosxom::1.5-dev git-master
Copyright 1996 to 2012, Will Guaraldi Kahn-Greene, under the Creative Commons BY-SA 3.0 license

Will's Blog by William Kahn-Greene is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.