Random thoughts

6 thoughts
last posted Aug. 17, 2014, 7:45 p.m.

1 earlier thought

0
class someclass:
    someattr = "foo"
    def somemethod(self):
        #self.y = self.y
        self.__class__.someattr = "bar"
        print self.someattr

someclass().somemethod()

interesting how that commented-out line makes a difference - I just learned a quirk of the python scoping rules.

4 later thoughts