Question: Error or misconcept

Károly Ladvánszky aa at bb.cc
Mon Nov 5 08:41:02 EST 2001


Thank you for your answer.

> You've just created a class level shared object a1.

Ok, but then I'd expect the same behaviour when a1 is a number.
Try this:

class c:
    a1=0
    def f1(self,a):
        self.a1=a

Now:
o1=c()
o1.f1(99)
o1.a1 ==> 99
o2=c()
o2.a1 ==> 0 ! Shouldn't it reflect the change in the class level object's
value just like in the case a1 is a list?

Cheers,

Károly


______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net



More information about the Python-list mailing list