How to override the doc of an object instance.
Maric Michaud
maric at aristote.info
Wed Jun 21 11:15:16 EDT 2006
Le Mercredi 21 Juin 2006 15:58, David Huard a écrit :
> On Wed, 21 Jun 2006 15:39:02 +0200, Maric Michaud wrote:
> > This is w.__class__.x.__doc__.
>
> Thanks,
>
> So in order to implement what I want, I should rather consider an
> ipython hack to print w.__class__.x.__doc__ when it exists, instead of
> w.x.__doc_ ? Does this makes sense or it will ruin the standard behaviour?
>
You can replace __IPYTHON__.magic_pinfo at startup to honor properies, but the
help command is already more explicit, try :
In [53]: class a(object) :
....: x=property(lambda s: 0, doc='my doc string')
....:
....:
In [54]: b=a()
In [55]: help(b)
Also you can do something like that (put it in some startup script) :
In [27]: __IPYTHON__.old_pinfo = __IPYTHON__.magic_pinfo
In [28]: def new_pinfo(obj) :
....: return __IPYTHON__.old_pinfo('modified_version_of_obj')
....:
In [29]: __IPYTHON__.magic_pinfo = new_pinfo
But you can also send a bug report to Ipython maintainer :)
> David
--
_____________
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