[Python-3000] Total ordering and __cmp__

Guido van Rossum guido at python.org
Wed Mar 21 18:19:37 CET 2007


On 3/21/07, Georg Brandl <g.brandl at gmx.net> wrote:
> BTW, was it intentional that dicts can't be compared via ">" and "<"
> anymore?

Yes. In old Python it made sense since all objects were supposed to be
orderable *somehow* (in the truly distant past, comparisons weren't
even allowed to raise exceptions!). In Py3k that assumption has been
dropped. The ordering for dicts is not particularly useful, hard to
explain, and hard to compute. On the other hand, equality testing is
straightforward.

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


More information about the Python-3000 mailing list