What’s the correct way to sort Python `import x` and `from x import y` statements?

The python style guide suggests to group imports like this: Imports should be grouped in the following order: standard library imports related third party imports local application/library specific imports However, it does not mention anything how the two different ways of imports should be laid out: from foo import bar import foo There are multiple … Read more

Why does PEP-8 specify a maximum line length of 79 characters? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

What is PEP8’s E128: continuation line under-indented for visual indent?

Just opened a file with Sublime Text (with Sublime Linter) and noticed a PEP8 formatting error that I’d never seen before. Here’s the text: urlpatterns = patterns(”, url(r’^$’, listing, name=”investment-listing”), ) It’s flagging the second argument, the line that starts url(…) I was about to disable this check in ST2 but I’d like to know … Read more

Pylint, PyChecker or PyFlakes? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Python `if x is not None` or `if not x is None`? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I’ve always thought of the if not x is None version to be more clear, but Google’s style guide and … Read more