> Although nothing in Python prevents defining __eq__() how you want and
> having it return other values can still be problematic to do so
> because of the way that __eq__() is tied to __hash__() and used in
> dicts and sets.

I think, this can work if you guarantee there are no hash collisions.  This is 
doable,
if you restrict yourself by some symbolic class hierarchy: e.g. you can 
enumerate
symbolic objects within the session.  Probably, id() will work: remember - all 
your
objects are singletons!

But you will not be able to mix built-in data types and your symbolic objects in
same set, for example.  In fact, this might be not a too high price: e.g. SymPy
already uses Integer's and Rational's instead of built-in types.  So, every 
"external"
object must be converted to your class hierarchy.

> Also a==b should only return True

That's an easy thing, but I doubt that the docs enforce us to do this.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BLZGOFVE6MMKDCS3TK2NJ6JJMFZGXJYD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to