[Python-Dev] (Don't Read If You're Busy With 2.1b2) "Rich" Comparisons?

Guido van Rossum guido@digicool.com
Fri, 23 Mar 2001 14:20:21 -0500


> Now that we have rich comparisons, I've suddenly realized they are
> not rich enough. Consider a set type.
> 
> >>> a = set([1,2])
> >>> b = set([1,3])
> >>> a>b
> 0
> >>> a<b
> 0

I'd expect both of these to raise an exception.

> >>> max(a,b) == a
> 1
> 
> While I'd like
> 
> >>> max(a,b) == set([1,2,3])
> >>> min(a,b) == set([1])

You shouldn't call that max() or min().  These functions are supposed
to return one of their arguments (or an item from their argument
collection), not a composite.

--Guido van Rossum (home page: http://www.python.org/~guido/)