I was kinda surprised that setting __class__ or __dict__ goes through
the __setattr__ mechanism, like a normal attribute:

class Foo(object):
    def __setattr__(self, attr, value):
        pass

class Bar(object):
    pass

>>> f = Foo()
>>> f.__class__ = Bar
>>> print f.__class__ is Foo
True

Is there a way (even hackish) to bypass this, or at least achieve
somehow the same goal (change f's class) ?

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to