Python interpreter bug

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 11:20:59 EDT 2005


alainpoint at yahoo.fr wrote:
> In fact, i want to sort the list based on the 'allocated attribute' and
> at the same time, test membership based on the id attribute.
> __cmp__ logically implies an ordering test

really?

    http://dictionary.reference.com/search?q=compare

    com·pare
    v. com·pared, com·par·ing, com·pares
    v. tr.
    1. To consider or describe as similar, equal, or analogous; liken.
    2. To examine in order to note the similarities or differences of.
    /.../

> not an identity test.

it's not an identity test.  it's a comparision, and the "in" operator
uses it to determine *equality*, not identity.  you need to read
up on object comparisions in the reference manual.

</F>






More information about the Python-list mailing list