[Tutor] Variable Modification in a class

Mehta, Anish Anish.Mehta@enst-bretagne.fr
Tue Jun 3 12:10:02 2003


Your point looks to me very right but the problem still remains the 
same. The output is still
30 40
30 40

May be i am making some mistake here again.

class AB:
    def __init__(self):
        self.a = None
        self.b = None

def func(ab):
    b = ab()
    c = ab()

    b.a = 5
    b.b = 10

    c = b
    c.a = 30
    c.b = 40

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



Regards.




Rick Pasotto wrote:

>This defines two alternate names for the class 'ab'. It does not create
>instances of the class. To do that you would need to do:
>
>	b = ab()
>	c = ab()
>
>  
>