[Tutor] Readabilty vs 80 characters
Tino Dai
oberoc at gmail.com
Thu Apr 19 15:29:33 CEST 2012
Hi!
I have a question about style. In PEP-8, it says don't exceed 79
characters, but can this rule ever be trumped by
readability?
Eg.
if someobject.filter(something) \
.filter(somethingreallyreallyreallyreallylong ==
somethingelsereallyreallylong) \
.filter(othethingreallylongreallyreally ==
ternarythingreallyreallyreallylong) \
.filter(thirdthingreallylessreallymaybelong ==
thirdotherthingreallylong) \
.first():
< do something >
if someobject.filter(something) \
.filter(somethingreallyreallyreallyreallylong == \
somethingelsereallyreallylong) \
.filter(othethingreallylongreallyreally == \
ternarythingreallyreallyreallylong ) \
.filter(thirdthingreallylessreallymaybelong == \
thirdotherthingreallylong) \
.first():
< do something >
The first example is more readable to me but violates the 80 character
rule. The second is less readable, but doesn't violate
the 80 character rule.
Is there a guideline or convention that pythonistas follow about this style
case?
Thanks,
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120419/1460ab4b/attachment.html>
More information about the Tutor
mailing list