Variable Modifications in a class

Greg Unrein greg at amstlc.com
Tue Jun 3 19:19:45 CEST 2003


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.

> 
>   c.a = 30
>   c.b = 40
> 
>   print b.a, b.b
>   print c.a, c.b
>   t = func(AB)
> 





More information about the Python-list mailing list