En Sun, 23 Dec 2007 08:05:18 -0300, Peter Otten <[EMAIL PROTECTED]> escribió:
>> Still, when I execute all three methods, I get two instances that are >> equal and the third is different. >> Is there some circomstance that makes two object creations result in the >> same object? >> >> ============================================================= output >> Output from the (test)program is: >> cpu class = <cpu.CPU instance at 0x8244eec> >> .cpu class = <cpu.CPU instance at 0x8244eec> >> .cpu class = <cpu.CPU instance at 0x8244f0c> >> . > > That two instances of CPU print the same "at 0x..." representation > doesn't > mean they are the same object, they may just be located at the same > location in memory. For that to happen it is neccessary (but not > sufficient) for the first instance to be garbage-collected. One way to avoid such ambiguity is to ensure that all three objects are alive at the same time; by example, inserting them into some global list. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list