js at jeannot.org
Sun Feb 29 03:26:46 CET 2004
In article <40414A60.F5F64A96 at alcyone.com>,
Erik Max Francis <max at alcyone.com> wrote:
> Jean-Sebastien Roy wrote:
> > I'm trying to create an object to be used as a key in a dictionary,
> > where comparison (for key retrieval) would be done by 'is' instead of
> > __eq__.
> > (__eq__ is defined in this object, but serve another purpose and does
> > not return a boolean).
> Why would you override __eq__ in such a bizarre way?
For example to do symbolic calculation where a == b is an expression
instead of a comparison.
I should add a precision to my question:
I found a post by Tim Peters (on 2001-07-08) that said:
> no comparison is done unless the full hash codes are equal
It seems to be exactly what I need, but is it a guarantee or will it
change in the next versions ?
More information about the Python-list