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 that use this id in the command line. Can someone help me try > this on your PC, I want to know which is the problem: this version of > python, or my PC. "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() >>>> id(list.count.__doc__) > 11863968 >>>> id(list.count.__doc__) > 11863968 >>>> id(list.count.__doc__) > 11863968 >>>> id(list.count.__doc__) > 11863968 This behavior is an accident. The actual doc strings are stored as C null-terminated strings inside the C structures defining the list type. When you request list.append.__doc__, a Python string object has to be built pointing to the original C string. After the call to id(), nobody references that string object, and it is garbage collected. Next time you request the same thing, depending on the details on how the memory allocator works, it may or may not reuse the same memory address. Try with some print "hello" in between those id calls. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list