pydoc preference for triple double over triple single quotes-- anyreason?
Brian van den Broek
bvande at po-box.mcgill.ca
Sun Apr 17 17:11:00 EDT 2005
Kent Johnson said unto the world upon 2005-04-17 16:17:
> Brian van den Broek wrote:
>
>> Kent Johnson said unto the world upon 2005-04-16 16:41:
>>
>>> Brian van den Broek wrote:
>>>
>>>> I've just spent a frustrating bit of time figuring out why pydoc
>>>> didn't extract a description from my module docstrings. Even though
>>>> I had a well formed docstring (one line, followed by a blank line,
>>>> followed by the rest of the docstring), when I ran Module docs, my
>>>> modules showed up as having "no description". ("Module docs"
>>>> referring to the shortcut installed on Windows that launches the
>>>> pydoc server.)
>>>
>>>
>>> ?? It works for me with triple-single quoted strings...from a quick
>>> look it appears that pydoc uses inspect which looks at the __doc__
>>> attribute; do your modules have __doc__ attributes?
>>>
>> Kent, that's odd. My module does have a valid docstring and hence a
>> __doc__ attribute (I did explicitly check). help(my_module) works fine
>> at the prompt. It is just the results list in the TKinter interface to
>> the pydoc server application that doesn't seem to pick up my module's
>> description (in the first line of its docstring) when the docstring is
>> triple-single quoted.
>
>
> I'm not sure what you mean by "the results list in the TKinter interface
> to the pydoc server". I ran the server, clicked "open browser" and
> browsed to a module in site-packages; that worked fine for me under
> Win2K and Python 2.4.1.
>
> Kent
By "the TKinter interface to the pydoc server" I mean the window that
pops up when you select the Module Docs shortcut. It is pictured here
<http://www.onlamp.com/python/2001/04/18/graphics/pydoc1.gif>, which
is Fig.1 in an article on pydoc by Cameron Laird
<http://www.onlamp.com/pub/a/python/2001/04/18/pydoc.html>. By
"results list" I mean the gray-backround'ed box immediately below the
"Search for" input box in the illustration.
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)".)
At any rate, such was the (minor) irritation which caused me to launch
the thread. It took me a bit to work out that the quote-style was what
made the difference, and a preliminary google didn't cast light.
2/3rd's the point of the post was to make the problem resolvable by
google.
Thanks for your continued efforts to understand what I'm on about. :-)
Best to all,
Brian vdB
More information about the Python-list
mailing list