HYRY a écrit :
>> There's no such thing as an "original method" - what's stored as an
>> attribute of the class is a plain function. FWIW, you can get at this
>> function quite easily - via the im_func attribute of the method.
>
> I know about im_func, but I tried the im_func attribute of append a
HYRY <[EMAIL PROTECTED]> writes:
> This works, but I think the key of DOC is too long, so I want to use
> the id of list.append.__doc__ as the key; or use the id of
> list.append:
Using the id is not a good idea because id's are not permanent. Using
list.append as the hash key will work and will
> There's no such thing as an "original method" - what's stored as an
> attribute of the class is a plain function. FWIW, you can get at this
> function quite easily - via the im_func attribute of the method.
I know about im_func, but I tried the im_func attribute of append and
I get error: 'built
HYRY wrote:
> This works, but I think the key of DOC is too long, so I want to use
> the id of list.append.__doc__ as the key; or use the id of
> list.append:
>
> DOC[id(list.append.__doc__)] = "..."
> DOC[id(list.append)] = "..."
>
> So, I asked how to get list.append from a.append, and why
> i
HYRY a écrit :
>> No. a.append is a "bound method" - a method that already has an
>> associated instance, that will be provided as the first argument to the
>> method call. Bound methods are created "on the fly".
>>
>
> Does this means there is no method to get the original methods from
> the Boun
En Wed, 26 Sep 2007 03:29:09 -0300, HYRY <[EMAIL PROTECTED]> escribi�:
> I want to add a docstring translator into the Python interpreter. If
> the user input:
a = [1,2,3]
a.append(
> this translator will show the docstring of append in my native
> language. Because __doc__ is read only,
> "the problem"?
> Perhaps if you explain what you really want to do, someone can think the
> way to do that, most likely *not* using id()
Thanks, now I know I cannot use id() for my problem.
Here is my problem:
I want to add a docstring translator into the Python interpreter. If
the user input:
En Wed, 26 Sep 2007 01:22:37 -0300, HYRY <[EMAIL PROTECTED]> escribi�:
> I installed python 2.4.4 and tried id(list.append.__doc__) again, here
> is the result, only id(list.append.__doc__) changes, this is strange,
> and only happened in the command line. Because I am doing something
> program th
> No. a.append is a "bound method" - a method that already has an
> associated instance, that will be provided as the first argument to the
> method call. Bound methods are created "on the fly".
>
Does this means there is no method to get the original methods from
the Bound methods created "on the
HYRY wrote:
> I have the following questions, I am using Python 2.4.2
>
a = [1,2,3]
id(a.append)
> 19167152 #1
id(list.append)
> 11306608 #1
>
> 1. the address of a.append and list.append is different, can I get the
> address of list.append from a.append?
>
No.
10 matches
Mail list logo