[Tutor] Class reference problem?

spartan-ii@tds.net spartan-ii at tds.net
Sat Jun 4 02:40:03 CEST 2005


for item in function1(args):
     object = class()
     if (function2(item)):
         if (condition):
             object.variable = value
             object.function()
             print object # debug
     print object #debug

The above pseudo code (not really, but close enough) is essentially what 
I'm playing with. I hope it gives a sense of what I'm trying to do.

Any way, the debug lines both print "<__main__.CLASSNAME instance at 
ADDRESS>" like they should, but the addresses never match up. This leads 
me to believe that the original object isn't being referenced inside the 
second if block. This idea is reinforced slightly by the fact that 
outside of the two if blocks, the variable of the original object has 
not been modified.

I've not encountered this problem before and I really have no idea what 
I should Google for. So, am I missing something or is there a way to get 
around this problem? This is being attempted with Python 2.4.1, by the 
way. I thank you in advance and apologize if I simply have not 
researched by problem thoroughly enough.


More information about the Tutor mailing list