Variable Modifications in a class

Greg Unrein greg at amstlc.com
Tue Jun 3 13:44:14 EDT 2003


Thanks Peter, I should have been more precise.

Peter Hansen wrote:
> Greg Unrein wrote:
> 
>>Mehta, Anish wrote:
>>
>>>def func(ab):
>>>  b = ab()
>>>  c = ab()
>>>
>>>  b.a = 5
>>>  b.b = 10
>>>
>>>  c = b
>>
>>This is your problem. c and b are the same object.
> 
> 
> Clearer to say that c and b are *bound* to the same object.
> They are not themselves the objects.  In Python terminology
> they are "names", or variables if you like that term, but
> in traditional terms they are more like pointers to the object
> than they are like the object itself.





More information about the Python-list mailing list