downcasting problem

John Nagle nagle at animats.com
Mon Oct 25 13:56:44 EDT 2010


On 10/25/2010 7:38 AM, Tim Chase wrote:
> While a dirty hack for which I'd tend to smack anybody who used it...you
> *can* assign to instance.__class__

    That's an implementation detail of CPython.  May not work in 
IronPython, Unladen Swallow, PyPy, or Shed Skin.

(An implementation with a JIT has to trap stores into some
internal variables and invalidate the generated code.
This adds considerable complexity to the virtual machine.
Java JVMs, for example, don't have to support that.)

				John Nagle



More information about the Python-list mailing list