Downcast (I know it sounds silly, but ...)

Peter Hansen peter at engcorp.com
Thu Jan 2 19:17:53 EST 2003


Rocco Rossi wrote:
> 
> I was wondering if it is possible in Python to do something analogous to
> downcasting in a statically typed language like C++. I mean is it possible
> to take an instance of a base class and magically transform it into an
> instance of some derived class eventually fixing things (like the missing
> attribute data)?

You might want to explain why you think you need that (if this
was not just idle curiosity).

Then others here will explain why you are wrong, and how to go
about it in the Right Way. 

:-)

-Peter




More information about the Python-list mailing list