[Python-ideas] comparison of operator.itemgetter objects

Jim Jewett jimjjewett at gmail.com
Thu Apr 5 18:03:34 CEST 2012


On Mon, Apr 2, 2012 at 5:38 AM, Steven D'Aprano <steve at pearwood.info> wrote:

> In general, I think that having equality tests fall back on identity test is
> so rarely what you actually want that sometimes I wonder why we bother.

Because identity ==> equality.  (There are exceptions, like NaN, but
that behavior is buggy.)  And for objects without a comparison
function, the most commonly made comparison (e.g., as a dict key) is
one where identity is desired.

-jJ



More information about the Python-ideas mailing list