I was kinda surprised that setting __class__ or __dict__ goes through
the __setattr__ mechanism, like a normal attribute:
class Foo(object):
def __setattr__(sel f, attr, value):
pass
class Bar(object):
pass
True
Is there a way (even hackish) to bypass this, or at least achieve
somehow the same goal (change f's class) ?
George
the __setattr__ mechanism, like a normal attribute:
class Foo(object):
def __setattr__(sel f, attr, value):
pass
class Bar(object):
pass
>>f = Foo()
>>f.__class__ = Bar
>>print f.__class__ is Foo
>>f.__class__ = Bar
>>print f.__class__ is Foo
Is there a way (even hackish) to bypass this, or at least achieve
somehow the same goal (change f's class) ?
George
Comment