[Python-Dev] [Python-checkins] peps: Add rules for indenting continuation lines.

Glenn Linderman v+python at g.nevcal.com
Fri Jun 3 01:16:30 CEST 2011


On 6/2/2011 3:49 PM, Guido van Rossum wrote:
> Except that the rule gets more complicated. I don't think that always
> using the double indent is going to mean a lot more line breaks, so I
> don't think there's much benefit to the added complication.

Further, tools like python-mode would have to go back and fix the indent 
to be double indented when there are multiple lines, and the : is not 
typed until the last line... not impossible, but more complicated, and 
some of the intervening lines might be too long for the double indent, 
and then manual adjustments would have to happen.  Ick.

Double indent from the beginning, if there is nothing after the (.

Or key the double indent off the leading keywords that end with :

Here's a language question, though: if there are keywords that imply the 
need for a :, and it isn't on the same line, why is \ needed to continue 
to the next line (or parentheses, etc.)?

If the : is truly omitted, like I did in my example, there'll be other 
syntax errors to report.  If it is just on a later line, why complain 
about it missing?

With complex conditions, I wind up adding extra () rather than trailing 
\, and that is about the only time I have ever found the need to use \ 
(but my workaround is to add the ()).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110602/bf4f0d03/attachment-0001.html>


More information about the Python-Dev mailing list