Wrapping comments

Scott David Daniels Scott.Daniels at Acm.Org
Sat May 9 10:19:45 EDT 2009


Tobias Weber wrote:
> the guideline (PEP 8) is hard wrap to 7x characters. The reason given is 
> that soft wrap makes code illegible.
> 
> So what if you hard wrap code but let comments and docstrings soft-wrap?
You apparently have caught the soft-/hard- disease spread by several
software retailers.  There are no such characters as "hard break,"
"soft break,"  "hard space,"  and "soft space."  Check you ASCII or
Unicode standards if you disagree.  There is a "non-breaking space"
in Unicode, but it doesn't mean what you mean.

If you cannot fix everyone else's editors, print drivers, and display
software to have a "soft wrap" that suits their style, then you are
asking others to bend their workflow to suit your style.  This rule
is not to make the writing or altering of code easier; it is about
making the _reading_ of code easier.  Think of it as a "treaty
point," like the "no tabs" rule -- violating it works fine for any
individual, but following it eases cooperative work.

> ... Or are there editors that can do a "soft hard wrap" while
> keeping  indentation and #comment markers intact?
At least vim and emacs can do so.  Some other editors redefine
standards in order to make their work easier.

--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-list mailing list