[Python-ideas] Automatic comparisons by default

Facundo Batista facundobatista at gmail.com
Tue Mar 15 23:34:06 CET 2011


On Tue, Mar 15, 2011 at 5:33 PM, Guido van Rossum <guido at python.org> wrote:
> By now it should be clear that this is a very complicated area. The
> subtleties to consider include but are probably not limited to:

Yes, it's very complicated, :|
I'll pursue only the idea of automatic __ne__
> - what to do with object, which defines all six operations already
>> - relationship between < and >=: Facundo said in his first message
> that "cmp" could be replaced by just <= and ==, but I do not believe
> that always works (e.g. sets)

But I was wrong... AFAIK now, you need __lt__ for ordering, and __eq__
/ __ne__ for equality comparison, and the other methods for richer
comparison.
Thanks!
-- 
.    Facundo
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /