"Kent Johnson" <[EMAIL PROTECTED]> wrote

>> if type(x) == type(int()):
>>
> For the built-in types, since Python 2.2 the familiar name (int, 
> str,
> float, list, dict, set) *is* the type and you can compare to that
> directly, e.g.:
>
> In [13]: type(3)==int
> Out[13]: True

I knew I should be able to use int but I tried to be too clever
and used type(int) which of course returns 'type type'. So I
used the default int() constructor which returns zero...

For some reason I never thought of simply comparing type()
to int... doh!

Thanks Kent,

Alan g. 


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to