[IPython-user] Printing the doc of the class object instead of the object instance
david.huard at gmail.com
Wed Jun 21 09:48:14 CDT 2006
I'm coding a class with attributes where the __set__ method is overloaded
using property, and it annoys me that the docstring printed is the string
from the instance instead of the string from the class, as it is not very
useful in my context.
For example, if we define
class widget (object):
"""This is a widget."""
self._x = None
def fset(self, value):
self._x = value
print self._x, 'Ok'
x = property(fget = fget, fset = fset, doc= "Set x to an int between
2 and 4")
w = widget()
w.x = 5
will print the docstring of an int. Is it possible for ipython to print
w.__class__.x.__doc__ instead ?
More information about the IPython-user