Top "Pep8" questions

Coding conventions and style guidelines for Python.

What does '# noqa' mean in Python comments?

While searching through a Python project, I found a few lines commented with # noqa. import sys sys.path.append(r'C:\…

python comments terminology code-analysis pep8
Define functions with too many arguments to abide by PEP8 standard

I have defined a function with a long list of arguments. The total characters in definition is above 80 and doesn't …

python pep8
How can I make my Python code stay under 80 characters a line?

I have written some Python in which some lines exceed 80 characters in length, which is a threshold I need to …

python pep8
How to break a line of chained methods in Python?

I have a line of the following code (don't blame for naming conventions, they are not mine): subkeyword = Session.query( …

python coding-style pep8
pep8 warning on regex string in Python, Eclipse

Why is pep8 complaining on the next string in the code? import re re.compile("\d{3}") The warning I receive: …

python string eclipse pydev pep8
PEP 8, why no spaces around '=' in keyword argument or a default parameter value?

Why does PEP 8 recommend not having spaces around = in a keyword argument or a default parameter value? Is this inconsistent …

python coding-style pep8
PEP8 – import not at top of file with sys.path

Problem PEP8 has a rule about putting imports at the top of a file: Imports are always put at the …

python python-3.x pep8
Correct style for line breaks when chaining methods in Python

I have some code like this. Should the break occur before the periods or after? # before my_var = somethinglikethis.where(…

python coding-style line-breaks pep8
Import order coding standard

PEP8 suggests that: Imports should be grouped in the following order: standard library imports related third party imports local application/…

python python-import static-analysis pep8
Line continuation for list comprehensions or generator expressions in python

How are you supposed to break up a very long list comprehension? [something_that_is_pretty_long for something_that_…

python coding-style list-comprehension pep8