Comparison operators in Python

Terry Reedy tjreedy at udel.edu
Thu Jun 2 02:09:11 EDT 2011


On 6/1/2011 8:44 PM, harrismh777 wrote:
> Ian Kelly wrote:

 >> ?? wrote
>>> integer. However comparison between a string and an integer seems to
>>> be permitted. Is there any rationale behind this ?

>> It allows things like sorting of heterogeneous lists. It's generally
>> viewed as a wart, though, and it was fixed in Python 3:

This was a Python 1.0 idea that Guido decided was more bug-inducing than 
useful.

> Just another example (excluding print 1/2 and unicode) where 3.x seems
> to be completely compatible with 2.x/ (tongue-in-cheek)

Arbitrary comparisons were broken and effectively deprecated about a 
decade ago with the introduction of the complex type. Just another 
example where 3.x completes a process of change started years before.

-- 
Terry Jan Reedy




More information about the Python-list mailing list