Comparisons of incompatible types

Terry Reedy tjreedy at udel.edu
Mon Dec 6 14:34:42 EST 2010


On 12/6/2010 12:46 PM, Robert Kern wrote:
> On 12/6/10 11:16 AM, TomF wrote:

>> Given that the semantics are virtually random, how could code depend
>> on this?
>
> There are cases where you don't particularly care *what* order is given
> as long as it is consistent. Let's say you want to make sure that two
> lists have the same contents (which may mix types), but you don't care
> about the order. You could just sort each list and then compare the
> sorted lists. Before sets were added to the language, this was a fairly
> common approach.

And indeed, code like this that has not been updated does break in 3.x. 
to some people's annoyance. We really really cannot please everyone ;-).

-- 
Terry Jan Reedy




More information about the Python-list mailing list