How to override the doc of an object instance.
Maric Michaud
maric at aristote.info
Wed Jun 21 09:39:02 EDT 2006
Le Mercredi 21 Juin 2006 06:50, David Huard a écrit :
> 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__
This is w.__class__.x.__doc__.
w.x return the value you put in self._x, say an int, so w.x.__doc__ will print
the docstring of int.
--
_____________
Maric Michaud
_____________
Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
More information about the Python-list
mailing list