git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Conforming to pep8

From
W. Trevor King <wking@tremily.us>
Date
May 9, 2014, 16:01 UTC
Message-ID
<20140509160130.GA28634@odin.tremily.us>
In-Reply-To
<20140509074402.GE9051@wst420>
On Fri, May 09, 2014 at 02:44:02AM -0500, William Giokas wrote:
Show 9 quoted lines
> 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
Previous: William GiokasNext: Felipe Contreras
Message 12 of 14 in “Conforming to pep8”
  1. William GiokasMay 9, 2014
  2. Jonathan NiederMay 9, 2014
  3. Michael HaggertyMay 9, 2014
  4. Felipe ContrerasMay 9, 2014
  5. William GiokasMay 9, 2014
  6. Felipe ContrerasMay 9, 2014
  7. William GiokasMay 9, 2014
  8. Felipe ContrerasMay 9, 2014
  9. William GiokasMay 9, 2014
  10. Felipe ContrerasMay 9, 2014
  11. William GiokasMay 9, 2014
  12. W. Trevor KingMay 9, 2014
  13. Felipe ContrerasMay 9, 2014
  14. John KeepingMay 9, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.