converting base class instance to derived class instance

John Roth newsgroups at jhrothjr.com
Mon Feb 9 16:56:41 EST 2004


"François Pinard" <pinard at iro.umontreal.ca> wrote in message
news:mailman.1372.1076344361.12720.python-list at python.org...

>>> o.__class__ = C
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: __class__ assignment: only for heap types


By the way, what is a "heap type"?


I think they're refering to objects that are allocated
on the heap. I'm not sure what attempting to
instantiate object would do, but I suspect the result
would be a built-in that can't be modified.

John Roth
>>>


-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list