dynamic casting in python

Delaney, Timothy tdelaney at avaya.com
Thu Apr 19 22:55:34 EDT 2001


> How do I do it?
> Is it possible?

The real question should be ... "Is it necessary?"

The answer is ... "No".

Python has no concept of casting - everything is an object (unless it's a
type ...). You can pass any object (or type) to anywhere, and if you try to
do something with it that it doesn't support, an exception will be thrown.

This is one of the most basic things about python - everything has a type,
but it usually doesn't matter what that is. All you deal with are
references.

Tim Delaney




More information about the Python-list mailing list