A
Andrew Durdin
How do you get the docstring of a property? Suppose I have the following:
class Foo:
def _prop_get(self):
return 1
prop = property(_prop_get, doc="This is the docstring")
foo = Foo()
print foo.prop
print foo.prop.__doc__
This will display "1", followed by the docstring for an integer (which
is the docstring for the int() function). How can I get the property's
docstring as defined in the property() function?
class Foo:
def _prop_get(self):
return 1
prop = property(_prop_get, doc="This is the docstring")
foo = Foo()
print foo.prop
print foo.prop.__doc__
This will display "1", followed by the docstring for an integer (which
is the docstring for the int() function). How can I get the property's
docstring as defined in the property() function?