pydoc preference for triple double over triple single quotes--anyreason?

Brian van den Broek bvande at po-box.mcgill.ca
Mon Apr 18 23:39:43 EDT 2005


Kent Johnson said unto the world upon 2005-04-18 08:20:

<SNIP several iterations clarifying the problem>

>> The puzzle for me was that if I enter my module name in the "Search 
>> for" box, it shows up in the list of results, as expected. But whether 
>> the results list entry for my module incorporates the description form 
>> my module's docstring or instead shows my module as having "(no 
>> description)" is a function of which style of triple quotes I used. 
>> (If my module docstring is enclosed by triple double quotes, the 
>> description is extracted from my module's docstring. If it uses triple 
>> single quotes instead, for purposes of the results list my module's 
>> docstring is ignored, and the module is listed as having "(no 
>> description)".)
> 
> 
> OK, now I get it. I don't use pydoc much and I missed that display.
> 
> This is indeed a bug in pydoc. If you look at lines 194, 195 and 201 in 
> pydoc.py (Python 2.4.1 version) you can see that it is parsing out the 
> module docstring itself and it only looks for """ strings.
> 
> Here is a patch that accepts ''' strings as well. Though a better patch 
> would allow any kind of string. I filed a bug report at
> http://sourceforge.net/tracker/index.php?func=detail&aid=1185124&group_id=5470&atid=105470 
> 
> 
> Kent

<SNIP patch>

Thanks for sticking with this, Kent.

Also, thanks for the patch and for filing the bug. (I had thought of 
doing so before posting, but don't yet feel quite confident enough in 
my judgement that I'd be putting signal rather than noise into the 
bug-tracker.)

Best,

Brian vdB




More information about the Python-list mailing list