Could an object delegate itself into another?

Fred L. Drake, Jr. fdrake at acm.org
Thu Oct 21 17:33:49 EDT 1999


François Pinard <pinard at iro.umontreal.ca> writes:
 > 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"
        >>> c2.foo
        'bar'

  Not to be used in real code!


  -Fred

--
Fred L. Drake, Jr.	     <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list