Michael Michael - 11 months ago 55
Python Question

How to break a line in a function definition in Python according to pep8?

I have the following line of code that is just over the limit of 79 characters:

def ReportResults(self, intTestID, startTime, stopTime, version, serverType):

How do I break the line in the correct way according to pep8?

Answer Source

According to PEP8:

The Python standard library is conservative and requires limiting lines to 79 characters (and docstrings/comments to 72).

This is in my opinion the main rule to observe.

Besides this rule, PEP8 recommends aligning brackets, so I would do something like:

def report_results(self,

Note that I renamed your method report_results, following the recommended lower_case_with_underscores.