are docstrings for variables a bad idea?
Michele Simionato
michele.simionato at gmail.com
Fri Apr 21 09:29:41 EDT 2006
Notice that class attributes can already be annoted (properties have a
docstring). BTW
in Python 2.5 you have a convenient way to define readonly attributes
(for instance
constants) and give them a docstring. Here is an example:
class C(object):
@property
def pi(self):
'pi is 3.14159'
return 3.14159
c = C()
print c.pi
help(C.pi) # gives you the docstring
Michele Simionato
More information about the Python-list
mailing list