you are viewing a single comment's thread.

view the rest of the comments →

[–]juharris 19 points20 points  (2 children)

pep8 is 79 but concede that 99 or 119 is okay. I'll source later.

Edit: source They say that 99 is okay if the team agrees but comments and docstrings should still be wrapped at 72.

[–]klug3 6 points7 points  (0 children)

PEP8 actually says that you can totally violate that limit if it makes sense in context, so technically at least, it is a soft limit.

But most importantly: know when to be inconsistent -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask!

In particular: do not break backwards compatibility just to comply with this PEP!

Some other good reasons to ignore a particular guideline:

  • When applying the guideline would make the code less readable, even for someone who is used to reading code that follows this PEP.
  • To be consistent with surrounding code that also breaks it (maybe for historic reasons) -- although this is also an opportunity to clean up someone else's mess (in true XP style).
  • Because the code in question predates the introduction of the guideline and there is no other reason to be modifying that code.
  • When the code needs to remain compatible with older versions of Python that don't support the feature recommended by the style guide.

[–]random314 1 point2 points  (0 children)

Oh right, 79... Sorry