[Tutor] Testing a variable for being a number, string or other object...

Justin Heath justin at unixremedies.com
Tue Aug 12 10:38:20 EDT 2003


Marc Barry wrote:

> Dear All:
>
> My first question is how do I test if a variable is a number or a 
> string?  I need to to do this for error checking on values passed into 
> methods.
>
> The second question I have is does Python have a way of testing for 
> instances like Java does?  For example, the "instanceof" operator that 
> lets you determine if an instance is of a certain type?
>
> Regards,
>
> Marc
>
> _________________________________________________________________
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*   
> http://join.msn.com/?page=features/junkmail
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

Also checkout ClassFoo.__class__.__name__





More information about the Tutor mailing list