is this a python bug?

Wolfgang Lipp castor at
Wed Jun 6 18:36:56 EDT 2001

BTW, Mike, I tried your code, 

class Child:
    def __init__(self, parent):
        self.__dict__['parent'] = parent
    def __getattr__(self, attr):
        self.parent.a = 1
        self.parent.b = 1
        self.parent.c = 1
        return getattr(self.parent, attr)
class Parent:
    def __init__(self):
        self.a = Child(self)
print Parent().__dict__

and it *is* exactly the problem of mutation-while-accessing
problem! thanks!


More information about the Python-list mailing list