comparing strings and ints

Randall Hopper aa8vb at yahoo.com
Mon Apr 17 14:02:33 EDT 2000


Arg.  This just bit again (me this time), but with the max() function:

>>> max(3,'2')
'2'


I wish there'd have been a type exception here.  

For now, I guess just be very careful when parsing datafiles that you
convert all your numeric strings to some other type; you'll get no warning
if you don't.

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list