comparing str's with ints

Frank Tobin ftobin at neverending.org
Mon Apr 29 12:40:00 EDT 2002


This makes sense (arithmetic comparison):
>>> 3 > 5
0


This makes sense (lexigraphic comparison):
>>> 'a' > 'b'
0


BUT, *this* does not make sense:
>>> '5' > 3
1

What in the world is supposed to be the semantics of comparing a string
with an integer?  Seems like a type trap...

-- 
Frank Tobin		http://www.neverending.org/~ftobin/




More information about the Python-list mailing list