I'm searching for Python style guidelines
Matthew Woodcraft
mattheww at chiark.greenend.org.uk
Tue Jan 8 16:22:42 EST 2008
Paul McGuire <ptmcg at austin.rr.com> wrote:
> While not required by any means, you will also find it handy to follow
> *every* entry in the list with a comma, even the last one in the list
> (this is legal Python). That is, in your example:
>
> foo =3D [
> 'too long',
> 'too long too',
> 'too long too',
> 'last item',
> ]
>
> Later on when you want to reorder the items, then you can just copy/
> paste whole lines, even if moving to or from the bottom of the list.
> This is also a good argument for putting the closing ']' on its own
> line, instead of on the same line as the last item.
The other good reason for doing these two things is that they fit
better with the line-based rules that most source code management
systems use for merging.
-M-
More information about the Python-list
mailing list