How to override the doc of an object instance.

2006-06-21 Thread David Huard
nstead 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to override the doc of an object instance.

2006-06-21 Thread David Huard
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 stand

Re: How to override the doc of an object instance.

2006-06-21 Thread David Huard
Paul, Although your solution works for the class itself, it doesn't for class attributes, since they point to built-ins whose attributes are read-only. >>> w.x.__doc__ = widget.x.__doc__ AttributeError: 'int' object attribute '__doc__' is read-only Would the solution be to build a new type and

Re: How to override the doc of an object instance.

2006-06-21 Thread David Huard
On Wed, 21 Jun 2006 17:15:16 +0200, Maric Michaud wrote: > > In [53]: class a(object) : >: x=property(lambda s: 0, doc='my doc string') >: >: > > In [54]: b=a() > > In [55]: help(b) I agree it works, but for a class with tens of attributes, this is not very practical

Re: How to override the doc of an object instance.

2006-06-21 Thread David Huard
It works ! Wow. Thanks a lot. If you don't mind, I'll post your code to the ipython list so it can be reused. David -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatically exit the REPL

2008-09-16 Thread David Huard
blem, you might want to look at it (look at revision 868). HTH, David Huard -- http://mail.python.org/mailman/listinfo/python-list