check type when assignment

pipehappy pipehappy at gmail.com
Wed Jul 12 11:15:10 EDT 2006


Hello everyone:

Is there a way to check the type when do assignment?

if I write:
ab = bc
and want to make sure the return value of isinstance(bc, klass) is True
or I will raise
a exception.

Any suggestion?




More information about the Python-list mailing list