On Fri, May 09, 2014 at 02:44:02AM -0500, William Giokas wrote:
> Maybe a time to use something like::
> 
>   from mercurial import foo \
>                         bar \
>                         baz \
>                         ...
> 
> Would make that import into quite a few lines, but would help organize
> things and let you easily organize things in the future.

From PEP 8 [1]:
  The preferred way of wrapping long lines is by using Python's
  implied line continuation inside parentheses, brackets and
  braces. Long lines can be broken over multiple lines by wrapping
  expressions in parentheses. These should be used in preference to
  using a backslash for line continuation.

So I prefer something like:

  from mercurial import (
      bar,
      baz,
      foo,
      )

The indentation for the closing parenthesis is optional [2].  You can
of course do things like:

  from mercurial import (
      bar, baz,
      foo,
      )

but I prefer the complete specification of “single, alphebetized entry
per line”.  I'm happy to send patches if that style is ok.

Cheers,
Trevor

[1]: http://legacy.python.org/dev/peps/pep-0008/#maximum-line-length
[2]: http://legacy.python.org/dev/peps/pep-0008/#indentation

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to