the address of list.append and list.append.__doc__

HYRY ruoyu0088 at
Wed Sep 26 08:29:09 CEST 2007

> "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:
>>> a = [1,2,3]
>>> a.append(
this translator will show the docstring of append in my native
language. Because __doc__ is read only, I added a dict to the
interpreter as follows:

DOC[list.append.__doc__] = """ translated version of the __doc__ """

When it is the time to show docstring, the program get the translated
version from DOC.
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

DOC[id(list.append.__doc__)] = "..."
DOC[id(list.append)] = "..."

So, I asked how to get list.append from a.append, and why
id(list.append.__doc__) changes.

More information about the Python-list mailing list