Compare source code
mdw at distorted.org.uk
Thu Nov 4 21:23:31 CET 2010
Tim Harig <usernet at ilthio.net> writes:
> I use simple comments that are not effected by white space. I don't
> waste my time trying to make comments look artistic. They are there
> to convey information; not to look pretty. I really detest having to
> edit other peoples comment formatting where you have to re-align
> everything if the length of any of comment lines change.
I view source code as primarily a means of communication with human
readers, and only secondarily as being machine readable. I therefore
think it's worth the effort to make source code readily legible, for
example by making effective use of horizontal and vertical whitespace.
A long time ago, I spent a little while studying graphic design, so I
try to keep an eye on this sort of thing.
I'm interested in line length for two reasons: firstly, because I
believe that there's an optimum line length for easy and rapid reading,
which is probably a bit less than 80 columns; and secondly because I
find that I make more effective use of the available space on my screen
if I have several narrow columns rather than a few wide ones -- since
most lines in source files are short, a wide column ends up being mostly
empty on the right hand side, which is wasteful.
It's true that a source file is not the same as a typeset document: the
most obvious difference is that source files are modified over time,
sometimes by many hands, and that therefore some of the tradeoffs are
different. I dislike `pretty' boxes around large comments, for example,
because maintaining the right hand edge is unnecessarily tedious. But
sometimes careful alignment can help a reader spot a symmetry or find
his way through a repetitive section such a table more easily.
(Unfortunately, I appear to have strange ideas about what `legible'
More information about the Python-list