About the 79 character line recommendation
Stephen Hansen
shansen at advpubtech.com
Tue Dec 5 13:45:26 EST 2006
On 5 Dec 2006 09:55:20 -0800, Steve Bergman <steve at rueb.com> wrote:
> However, I am finding that the 79 character line prescription is not
> optimal for readability.
For me, 79 characters per line... would basically make my code a LOT
harder for me to read and manage.
I mean, a basic structure for a LOT of the code I end up working on is:
class foo:
def myMethod(self, arg1):
try:
try:
connection = ConnectionQueue.get()
...
finally:
ConnectionQueue.put(connection)
except:
logging.exception("foo::myMethod(%s) unknown error" % arg1)
At that point, i've lost 17-characters before I even start... Even some with
just a very simple SQL statement ends up with text at 85ish characters.
I might be biased, but my screen goes otu to about 200 characters-- and I'm
not writing an open source app :) If I was, I might be more inclined to
doing things in a more generally-readable way... but in my office scenario,
I don't have to worry about people who are only reading to 79 characters.
You have to evaluate your environment/audience, both current and of what it
may be in the future.
As a rule, if it's over about 125 characters, I try to split it up into
different lines.
While I'm on this general topic, the guide mentions a pet peeve about
> inserting more than one space to line up the "=" in assignment
> statements. To me, lining them up, even if it requires quite a few
> extra spaces, helps readability quite a bit. Comments?
I like lining up the equal statements/other punctuation for things that are
all the "same". Like, if I'm using building up an event table w/ wxWidgets,
I'll have all the arguments in the self.Bind(...) line up because then it's
easier to scan for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061205/bdde1ce8/attachment.html>
More information about the Python-list
mailing list