[Python-Dev] [Python-checkins] r60919 - peps/trunk/pep-0008.txt

Ron Adam rrr at ronadam.com
Sat Feb 23 02:47:40 CET 2008



Barry Warsaw wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Feb 21, 2008, at 12:33 PM, Ron Adam wrote:
> 
>> Barry Warsaw wrote:
>>
>>> Why should docstrings and comments be limited to 72 characters when
>>> code is limited to 79 characters?  I ask because there is an ongoing
>>> debate at my company about this.
>> I'm not sure if this is the main reason, but when using pydoc to view
>> docstrings, the 72 character width allows for the added indent in  
>> class and
>> method sections.
> 
> Interesting.  Maybe because I almost always put doctests in separate  
> files, I don't run into this too much.  Having an indent of 4 for  
> doctest code never really bothers me too much.

I think the 72 character limit refers to the length of the doc string, not 
the length of the line.

Pydoc, ie...the help() function, strips leading white space off and then 
adds it's own margin, 4 characters for function doc strings, and 8 
characters with a vertical bar for class method doc strings.

Longer than 72 character doc strings in class methods wrap and break up the 
output of the help function.

Ron












More information about the Python-Dev mailing list