PEP 8 and extraneous whitespace

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Thu Jul 21 16:28:52 EDT 2011


On 21 juil, 20:46, Andrew Berg <bahamutzero8... at gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
> On 2011.07.21 01:32 PM, Thomas Jollans wrote:> So, the PEP says: do not align operators. End of story.
>
> I'm pretty sure that colons, commas and equals signs are not operators.


1/ you can consider the equal sign ('=') is the "binding operator".

2/ since {'key':'val'} is equivalent to dict(key=val), you can
consider colons as a binding operator here

3/ since it's the comma - not the parens - that makes a tuple, ie "t =
1, 2" is equivalent to "t = (1,2)", you can also consider commas as an
operator here ;)

FWIW: I'm pretty anal when it comes to code formatting and coding
conventions (rationale : "don't make me think"), and I do agree with
pep8: consistent spacing between tokens is much more readable than
"aligned" stuff. And it's way less painfull to maintain...





More information about the Python-list mailing list