Kyle Brandt
Kyle Brandt

Reputation: 28417

Line Length for Inline Python Documentation

When writing inline documentation, is there a standard method for line breaks when it comes longer lines of text (Obviously this shouldn't happen too frequently)?

For example:

"This modules does blah blah blah blah blah blah blah blah blah blah blah blahblah blah blah blah blah blahblah blah blah blah blah blahblah blah blah blah blah blah"

Or should it be:

"This modules does blah blah blah blah blah blah blah blah blah blah blah 
blahblah blah blah blah blah blahblah blah blah blah blah blahblah blah 
blah blah blah blah"

If there is no well defined standard or tradition for this I'm not really looking for a debate, in which case the question should probably just be closed. But if there is a standard or very common practice I would like to know what it is.

Upvotes: 0

Views: 141

Answers (2)

pistache
pistache

Reputation: 6233

Lines are usually limited to 80 characters in the computer world, the PEP style guide recommends a maximum of 79.

Upvotes: 0

wim
wim

Reputation: 362945

For mulitiline comments like the example in your question, you can also use """triple quotes""" for your comments to span over newlines.

PEP 8 style guide recommends to

Limit all lines to a maximum of 79 characters

And also:

For flowing long blocks of text (docstrings or comments), limiting the length to 72 characters is recommended.

There is a particular section of the style guide concerning docstrings, a particular type of inline documentation, which you can find here.

Upvotes: 4

Related Questions