[MERGE] Document code layout stuff

Alexander Belchenko bialix at ukr.net
Wed Sep 5 18:16:38 BST 2007


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

Martin Pool пишет:
> This changes the developer guide to be more specific about how things should be
> spaced/indented. 
> 
> There have been a few cases where reviewers have said "please do X" when pep8
> doesn't (or doesn't clearly) require X.  abentley, lifeless and spiv said on
> irc that they agree with these rules (if I've captured them accurately).

> +Lines should be no more than 79 characters if at all possible.
> +Lines that continue a long statement may be indented in either of 
> +two ways:
> +
> +within the parenthesis or other character that opens the block, e.g.::
> +
> +    my_long_method(arg1,
> +                   arg2,
> +                   arg3)
> +
> +or indented by four spaces::
> +
> +    my_long_method(arg1,
> +        arg2,
> +        arg3)
> +
> +The first is considered clearer by some people; however it can be a bit
> +harder to maintain (e.g. when the method name changes), and it does not
> +work well if the relevant parenthesis is already far to the right.  Avoid
> +this::
> +
> +     self.legbone.kneebone.shinbone.toebone.shake_it(one,
> +                                                     two,
> +                                                     three)
> +
> +but rather ::
> +
> +     self.legbone.kneebone.shinbone.toebone.shake_it(one,
> +         two,
> +         three)
> +
> +or ::
> +
> +     self.legbone.kneebone.shinbone.toebone.shake_it(
> +         one, two, three)

bb:comment

What about assigning result to some value?

foo = self.legbone.kneebone.shinbone.toebone.shake_it(
         one, two, three)

What correct rule for this case?

- --
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3uR2zYr338mxwCURAjnnAJ95vCmMNir/vUWeoMl/Aa3qVBLhBgCfSTtR
wuhGOLn1+UUHBl/PM2KVZ3E=
=W+TH
-----END PGP SIGNATURE-----



More information about the bazaar mailing list