[RFC] Indentation / import rules

John Arbash Meinel john at arbash-meinel.com
Mon Jul 24 16:07:57 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> I read through PEP8, and I see a few places we could use some updates. I
>>> recommend everyone read it again. But it doesn't cover this usage.
> 
> I'm not sure I agree with that.  Although PEP8 describes imports, it
> also describes long-line handling:
> 
> The preferred way of wrapping long lines is by using Python's implied
> line continuation inside parentheses, brackets and braces.
> 
> The examples it gives would favour:
> 
> from bzrlib import (bar, foo, baz,
>                     llllllllllllllllong,
>                     short)
> 
> But I'll go along with whatever people want to do.
> 
> Aaron

Sure, but this conflicts with our desire to have good merging. PEP8
recommends adding multiple entries per line, but alphabetical sorting,
combined with one entry per line prevents conflicts.
So at the very least we should switch to:
from bzrlib import (bar,
                    baz,
                    foo,
                    llllllllllllllllong,
                    short)
But part of the point of our fix, is that we want to have single line
changes, and the above has multi-line changes for adding anything to the
beginning or end of the list. (You have to move the existing item to a
different line, and then add your line)

So we really should use:
from bzrlib import (
                    bar,
                    baz,
                    foo,
                    llllllllllllllllong,
                    short,
                    )
And from there, I think this looks better:
from bzrlib import (
    bar,
    baz,
    foo,
    llllllllllllllllong,
    short,
    )

But I would be happy with either of the last two.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFExOJNJdeBCYSNAAMRAuW8AJ90TSksa8kmMd9Nh/j/S9TRA+uihwCgrFVk
xeRPrPUQSmvEDHAlUj0pGyw=
=SWOi
-----END PGP SIGNATURE-----




More information about the bazaar mailing list