'20' <= 100

Jon Ribbens jon+usenet at unequivocal.co.uk
Thu May 1 19:08:24 EDT 2003


In article <mailman.1051827484.9692.python-list at python.org>, Gerhard Häring wrote:
>> i.e.  var1 <= var2
>> where var1 = '20' and var2 = 100
> 
> I'd prefer Python to raise an exception if you compare a number to 
> something non-numeric.

For '<', '<=', '>' and '>=' I agree, but for '==' and '!=' I very much
disagree since they have an obvious easy-to-define meaning (i.e.
that objects of incompatible types are different). As I understand it
'<' etc can produce exceptions these days, does anyone know if '=='
and '!=' can (in the absence of any weird non-standard user-defined
classes overriding __cmp__ or somesuch)?




More information about the Python-list mailing list