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'...
Steven D'Aprano wrote:
Mathematicians often *define* equality as identity. That certainly makes
sense when dealing with numbers -- what would it mean to say that there
are (say) three different instances of the abstract integer 42, all equal
yet not identical? I suggest that this simply doesn't make sense -- it is
"not even wrong".
Equality-as-identity may not hold in all areas of mathematics, but I
think it is safe to say it holds for ideal (abstract) numbers, as opposed
to implementations of numbers as bit patterns or objects in memory.
http://en.wikipedia.org/wiki/Equality_(mathematics)
but who knows? maybe abstract numbers -5 to 256 are optimized as well! :-)
--
http://mail.python.org/mailman/listinfo/python-list