On Thu, Jun 2, 2011 at 3:15 PM, Barry Warsaw <barry@python.org> wrote:
On Jun 02, 2011, at 12:57 PM, Glenn Linderman wrote:
On 6/2/2011 12:01 PM, Guido van Rossum wrote:
Bingo. That's why. (Though you are missing some colons in your examples.:-)
--Guido
You operate as a good Python compiler :)
Actually, this is a key insight, which I just mentioned in a private response to Steve. How about this for the rule:
If the hanging line ends in a colon, then double-indent (or "more-ly indented") seems appropriate. If not, then a single indent is sufficient.
That handles cases like this, where double indent makes sense:
def some_really_long_function_name( an_argument, another_argument, and_a_third_argument): foo()
---
if some_really_long_function_name( an_argument, another_argument, and_a_third_argument): foo()
---
and these cases where a single indent is fine:
x = some_really_long_function_name( an_argument, another_argument, and_a_third_argument) foo(x)
---
d = dict( a=1, b=2, c=3, d=4) return d
Does that cover it?
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. -- --Guido van Rossum (python.org/~guido)