A suspected bug

Colin J. Williams cjw at sympatico.ca
Sat Feb 17 20:45:39 EST 2001


It seems to me that the bit of code below should report
a type inconsistency. 
X-Mozilla-Status: 0009 Sep 20 2000, 12:29:43) [MSC 32 bit (Intel)] on win32.
Portions Copyright 1994-2000 Mark Hammond (MarkH at ActiveState.com) - see
'Help/About PythonWin' for further copyright information.
>>> print 2 > '1'
0
>>> print 1 > '2'
0
>>>

If we replace the comparison operator by an arithmetic operator,
we get:
>>> z= 1+'1'
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
TypeError: number coercion failed
>>>

Which is what I would have expected.

Colin W.




More information about the Python-list mailing list