Skip to content

Instantly share code, notes, and snippets.

@temoto
Created January 14, 2013 01:21
Show Gist options
  • Save temoto/4527143 to your computer and use it in GitHub Desktop.
Save temoto/4527143 to your computer and use it in GitHub Desktop.
Python pep8, long lines wrap rules, indentation
def inside():
# Good. Consistent. You know up front where to put continuation.
# Also consistently short, no matter how long is `xs = itertools.ifilter`.
xs = itertools.ifilter(fun, [very_long_name_1, very_long_name_2,
very_long_name_3, very_long_name4])
# Bad. Lots of space wasted. Rename 'xs' and you have to reindent everything.
xs = itertools.ifilter(fun,
[very_long_name_1, very_long_name_2,
very_long_name_3, very_long_name_4])
class A:
items = (
'how',
'about',
'this',
)
@nickaigi
Copy link

I prefer using this type of indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment