How to override the doc of an object instance.

D

David Huard

Hi,

I'm not really sure about the right terminology, but here is my question, boiled
down to this code:

class widget (object):
"""This is a widget."""
def __init__(self):
self._x = None
def fget(self):
return self._x
def fset(self, value):
self._x = value
print self._x, 'Ok'
x = property(fget = fget, fset = fset, doc= "It prints")


print widget.x.__doc__

w = widget()
w.x = 5
print w.x.__doc__

I would like the last statement to print the doc string that I specified in
property, instead of the docstring for an int. The goal is to have ipython print
that string with the command
w.x?
So the user knows what this attribute does, and how he can set it.

Is this possible ?

Thanks,

David Huard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top