Message26080
The built-in functions type() and isinstance() do not call
__getattribute__ for instances of user-defined classes.
Thus, for instance,
x.__class__ == sometype
and
type(x) == sometype
can give inconsistent results.
I ran into this problem in writing a transparent
persistence system, where instances of proxy classes
are used as stand-ins for unloaded objects and the
proxy does just-in-time loading by overloading
__getattribute__ and __setattr__ (which changes
__class__).
(This applies to 2.4.1.) |
|
Date |
User |
Action |
Args |
2007-08-23 14:33:53 | admin | link | issue1263635 messages |
2007-08-23 14:33:53 | admin | create | |
|