[Techtalk] Python doc strings
Carla Schroder
carla at bratgrrl.com
Sun Apr 25 15:18:11 EST 2004
Hidy ho,
What reads Python doc strings? Just to be crystal clear, I mean the comments
that are surrounded by quotation marks:
def wicked_kewl_function():
"""This is a multiline doc string.
See, here's the second line."""
The Python docs say some Python IDEs turn these into tool tips. I haven't seen
anything like this. Also, this does not work:
http://www.python.org/doc/current/tut/node6.html
>>> def my_function():
... """Do nothing, but document it.
...
... No, really, it doesn't do anything.
... """
... pass
...
>>> print my_function.__doc__
Do nothing, but document it.
No, really, it doesn't do anything.
When I try it, it does this:
>>> def wicked_kewl_function():
... """This is a multiline doc string.
...
... See, here's the second line."""
... pass
...
>>> print wicked_kewl_function._doc_
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'function' object has no attribute '_doc_'
>>>
Thanks!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Carla Schroder
this message brought to you
by Libranet 2.8 and Kmail
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Techtalk
mailing list