Pythonic list/tuple/dict layout?

Akira Kitada akitada at gmail.com
Sun Jan 25 07:36:36 EST 2009


> These are the only two that follow PEP 8; the others don't have
> four-space indent levels.

In those examples, the following sentence in PEP 8 would be applied.

"Make sure to indent the continued line appropriately."

> I actually use this style:
>
>    foo = {
>        0: 'spam',
>        1: 'eggs',
>        2: 'beans',
>        }
>
> because that makes it clear that *all* the indented lines are a
> continuation of the same statement, just like a suite of statements
> are all uniformly indented under (e.g.) a function definition.
>
> It seems that the author of the Python editing mode in Emacs agrees
> with me too (the style, at least, if not the reasoning), which makes
> my programming life easier.

Yes, it does, but people around me tend to prefer d1 style to that one.
One purpose of this silly thread is to figure out which is most popular one...



More information about the Python-list mailing list