On Fri, Jun 3, 2011 at 00:15, Barry Warsaw <barry at 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? I like it.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4