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 internally use the pointer to produce the hash key, which is probably what you want anyway. > So, I asked how to get list.append from a.append >>> def unbound(meth): ... return getattr(type(meth.__self__), meth.__name__) ... >>> unbound(a.append) <method 'append' of 'list' objects> > and why id(list.append.__doc__) changes. Because the doc for builtins is internally kept in a read-only C string for efficiency. The Python string is built only when actually used. -- http://mail.python.org/mailman/listinfo/python-list