[Tutor] checking for expected types from input file

Alan Gauld alan.gauld at btinternet.com
Thu Jul 31 07:56:00 CEST 2008


"Bryan Fodness" <bryan.fodness at gmail.com> wrote

> I have many variables of different types, and I want to do a check 
> in
> case something like ReferencePositionX = abc occurs.

In Python its usual to tackle that using try/except.
If you get a TypeError then try type conversion.
The saying goes somethinng like:
"Its better to ask forgivness than permission"

Alan G. 




More information about the Tutor mailing list