[Tutor] simple question about numeric types

Gregor Lingl glingl at aon.at
Wed May 3 00:24:18 CEST 2006


Hi!

Is there a simpler/fster way to check if a value
has int or float type (i.e. is a "real number") than:

v=<some numeric value>
if isinstance(v, int) or isinstance(v, float):
     <block>

(v must not be complex)

Regards,
Gregor




-- 
Gregor Lingl
Reisnerstrasse 3/19
A-1030 Wien

Telefon: +43 1 713 33 98
Mobil:   +43 664 140 35 27

Website: python4kids.net


More information about the Tutor mailing list