direct initialization of class attributes vs. declarations w/in __init__

digitalorganics at gmail.com digitalorganics at gmail.com
Mon Jun 12 00:06:46 CEST 2006


Fredrik Lundh wrote:
> digitalorganics at gmail.com wrote:
>
> > Any clue what's behind this behavior?
>
> a missing plus sign.
>
> </F>

Thanks for the guess but not possible given the following:

class Boo:
    jerk = 10

    def killjerk(self):
        counter = 3
        while counter !=0:
            counter -= 1
            self.jerk += 1
            print self.jerk
            print self.__class__.jerk


bing = Boo()
bing.killjerk()

Output from desktop comp.:
11
10
12
10
13
10

Output from laptop comp.:

1
10
2
10
3
10

?? . . .




More information about the Python-list mailing list