Wrapping comments

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat May 9 11:37:37 EDT 2009


On Sat, 09 May 2009 07:19:45 -0700, Scott David Daniels wrote:

> > 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.

You say that as if ASCII and Unicode are the only conceivable sets of 
characters.

Even if they are (and they're not), the OP didn't ask about inserting 
hard/soft *characters*. He asked about *actions*: hard-wrapping code and 
soft-wrapping comments. He does that (presumably) by inserting newline 
characters in code where he wants to force a new line, and telling his 
editor to wrap comments according to the editor's own algorithm 
(presumably some variation of the rule "if a line extends beyond the 
right-edge of the window, wrap it to the next line in the display, but do 
not insert a newline character"). This is not a disease, it is very 
useful when editing unstructured text. Believe it or not, text editors 
are not only useful for editing source code *wink*


[aside]
Personally, I think it is just a little bit sad that in 2009 we still 
write programs using editors which are character-based instead of token-
based and syntax-aware. At least good editors have syntax highlighting. 
Maybe in another 20 years, nobody will care about low-level details like 
the characters used to write code. Only the tokens really matter.
[/aside]


My own opinion is that if the OP is not sharing his code with anyone 
else, he can do whatever he likes. Nevertheless, there is value in 
sticking to the standards that the majority use, and so I tend to stick 
to a line length of 70 characters or less for both code and comments. I'm 
not religious about it though.



-- 
Steven



More information about the Python-list mailing list