Entry
Cached class (was: Could an object delegate itself into another?)
Jul 5th, 2000 10:01
Nathan Wallace, Hans Nowak, Snippet 198, Fred L. Drake
"""
Packages: oop
"""
"""
> But yet, I wonder. Could an object really delegates itself into
> another? For example, is there some way by which a newly created
> object could soon check, probably within __init__, if a similar copy
> has already been registered? If one similar object is found, this
A truely Vile Hack ;-)
"""
class C: pass
c1 = C()
c2 = C()
c2.__dict__ = c1.__dict__
c1.foo = "bar"
print c2.foo
# 'bar'
"""
Not to be used in real code!
"""