Python is readable

Ben Finney ben+python at benfinney.id.au
Thu Mar 15 19:57:33 EDT 2012


Arnaud Delobelle <arnodel at gmail.com> writes:

> On 15 March 2012 22:35, Ben Finney <ben+python at benfinney.id.au> wrote:
> > I agree, and am glad PEP 8 has been updated to recommend an extra
> > level of indentation for continuation, to distinguish from the new
> > block that follows
> > <URL:http://www.python.org/dev/peps/pep-0008/#indentation>.
>
> Personally I solve this by never writing if conditions that span more
> than one line.

The admonition applies not only to ‘if’ conditions, but also to ‘while’,
‘with’, ‘for’, etc.; and also to bracketing constructs like function
calls, literal lists/dicts/sets, etc. In a single statement, the
indentation for continuation lines should be indented two levels, so
that they don't look so much like a new block of statements.

-- 
 \           “If you do not trust the source do not use this program.” |
  `\                                —Microsoft Vista security dialogue |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list