negative numbers are not equal...

Christian Heimes lists at cheimes.de
Fri Aug 15 18:14:20 EDT 2008


ariel ledesma wrote:
> well, i'm glad i stumbled upon this detail early on (i only had to fix 
> about one page of code)... i'll just stick to 'is' when it concerns 
> checking if it is the *same* object (memorywise) instead of an 
> *equivalent* one...
> just before wrapping up, the special methods __eq__ and __ne__ are 
> called upon == and !=, right? not for 'is', 'is not'...

Correct! You can't change the identity operator 'is' with a magic method.

Christian




More information about the Python-list mailing list