In article ,
Thomas Jollans wrote:
>
>% python2.6
>Python 2.6.5+ (release26-maint, Jun 28 2010, 19:46:36)
>[GCC 4.4.4] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
class OLD: pass
>...
class NEW(object): pass
>...
OLD.__doc__ = "foo"
NEW.__
On 06/29/2010 02:37 AM, Ben Finney wrote:
> Brian Blais writes:
>
>> On Jun 28, 2010, at 14:25 , Chris Rebert wrote:
>>> __doc__ is normally defined on classes, e.g. `A`, not instances,
>>> e.g. `a`. help() looks for __doc__ accordingly.
>>
>> so that gets back to my original question: can I chan
On Tue, 29 Jun 2010 10:37:44 +1000, Ben Finney wrote:
> Brian Blais writes:
>
>> On Jun 28, 2010, at 14:25 , Chris Rebert wrote:
>> > __doc__ is normally defined on classes, e.g. `A`, not instances, e.g.
>> > `a`. help() looks for __doc__ accordingly.
>>
>> so that gets back to my original quest
Brian Blais writes:
> On Jun 28, 2010, at 14:25 , Chris Rebert wrote:
> > __doc__ is normally defined on classes, e.g. `A`, not instances,
> > e.g. `a`. help() looks for __doc__ accordingly.
>
> so that gets back to my original question: can I change this text at
> runtime. Doesn't look like I c
On Jun 28, 2010, at 14:25 , Chris Rebert wrote:
On Jun 27, 2010, at 22:37 , Red Forks wrote:
Read you doc file and set the __doc__ attr of the object you want to
change.
__doc__ is normally defined on classes, e.g. `A`, not instances, e.g.
`a`. help() looks for __doc__ accordingly.
Cheers,
> >>> i.__add__ = __add__
> >>> i+1
> 6
> >>>
>
> Was this in reference to a specific python version?
This doesn't work with new style classes and thus not in Python 3.x.
Subclass from object and you'll see the difference.
Christian
--
http://mail.python.org/mailman/listinfo/python-list
On 6/28/10 1:13 PM, Emile van Sebille wrote:
On 6/28/2010 12:02 PM Benjamin Kaplan said...
Just to save the OP some trouble later on: this optimization is done
for most of the __*__ methods. Overriding __add__ on an instance won't
change the behavior of a + b.
ActivePython 2.4.1 Build 247 (Act
On 06/28/2010 10:13 PM, Emile van Sebille wrote:
> On 6/28/2010 12:02 PM Benjamin Kaplan said...
>> Just to save the OP some trouble later on: this optimization is done
>> for most of the __*__ methods. Overriding __add__ on an instance won't
>> change the behavior of a + b.
>
> ActivePython 2.4.1
On Mon, Jun 28, 2010 at 1:13 PM, Emile van Sebille wrote:
> On 6/28/2010 12:02 PM Benjamin Kaplan said...
>
> Just to save the OP some trouble later on: this optimization is done
>> for most of the __*__ methods. Overriding __add__ on an instance won't
>> change the behavior of a + b.
>>
>
> Act
On 6/28/2010 12:02 PM Benjamin Kaplan said...
Just to save the OP some trouble later on: this optimization is done
for most of the __*__ methods. Overriding __add__ on an instance won't
change the behavior of a + b.
ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on
Python 2.4.1 (#65, Ju
On Mon, Jun 28, 2010 at 11:25 AM, Chris Rebert wrote:
> On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais wrote:
>> On Jun 27, 2010, at 22:37 , Red Forks wrote:
>>> Read you doc file and set the __doc__ attr of the object you want to
>>> change.
>>>
>>> On Monday, June 28, 2010, Brian Blais wrote:
>
On Mon, Jun 28, 2010 at 11:13 AM, Brian Blais wrote:
> On Jun 27, 2010, at 22:37 , Red Forks wrote:
>> Read you doc file and set the __doc__ attr of the object you want to
>> change.
>>
>> On Monday, June 28, 2010, Brian Blais wrote:
>>> I know that the help text for an object will give a descrip
On Jun 27, 2010, at 22:37 , Red Forks wrote:
Read you doc file and set the __doc__ attr of the object you want
to change.
On Monday, June 28, 2010, Brian Blais wrote:
I know that the help text for an object will give a description of
every method based on the doc string. Is there a way t
Read you doc file and set the __doc__ attr of the object you want to change.
On Monday, June 28, 2010, Brian Blais wrote:
> Hello,
>
> I know that the help text for an object will give a description of every
> method based on the doc string. Is there a way to add something to this
> text, spec
Hello,
I know that the help text for an object will give a description of
every method based on the doc string. Is there a way to add
something to this text, specific to an object, but generated at run-
time? I have an object that reads a file, and I would like part of
that file to be sh
15 matches
Mail list logo