[IPython-user] Printing the doc of the class object instead of the object instance
David Huard
david.huard at gmail.com
Wed Jun 21 12:06:01 CDT 2006
To complete and justify the question, here is an example of what I'd like
to be able to do:
In pylab, there are classes called axes that include dozens of attributes
such as ylim, xlim, face_color, etc. The way to set them right now is to
call
ax = axes()
ax.set_xlim(0,1)
and ax.get_xlim() returns the value of the attribute.
In a better world, xlim would simply be an object with fset and fget
methods, such that setting ax.lim = [0,1] would do the same job than
ax.set_xlim(0,1). While this is already possible to implement (and was
discussed a while ago on the matplotlib mailing list), calling ax.xlim?
would return the docstring of a list, instead of a class docstring
for xlim. In my opinion, this limits the usefulness of this kind of user
interface.
Maybe it is possible to create an object whose class doc overrides the
instance doc, but I didn't find how.
David
More information about the IPython-user
mailing list