-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbolic functions break the __hash__ contract #14608
Comments
comment:1
Within Sage it is impossible to satisfy "equal objects must have the same hash if they are hashable" because equality is too laxist.
Or
You can not hope to solve this problem with one ticket (because the Symbolic ring contains all Sage objects) ! |
comment:2
|
comment:3
(cc me) |
comment:8
See also #18092. The problem with simplify+substitute is probably another symptom of
|
comment:9
Now that we've decided to sacrifice readability for reducing the chance of name collisions with variables in conversion from SR to maxima:
we could ensure that name translation for functions from SR to maxima is injective as well. Theoretically, we could have
or something similar. Since LISP uses interned strings for symbols, it wouldn't even be inefficient in the "enhanced" interface to maxima_lib: once the dictionaries are seeded, the strings wouldn't be parsed. The strings-based interface would of course have a bit of a penalty, because it does all kind of regex stuff, so string length actually affects performance (but you'd probably have to work very hard to notice it) Note that this issue came up again on ask sagemath. |
comment:10
Replying to @nbruin:
There is a recent discussion of this issue on sage-devel. |
comment:11
It seems to me that the hash issue mentioned in the ticket description has been fixed since at least Sage 9.1. In particular, in Sage 9.1 and Sage 9.3.beta8, we have
Shall we close this ticket? |
Equal objects must have the same hash if they are hashable (http://docs.python.org/2/reference/datamodel.html#object.__hash__):
As reported on http://ask.sagemath.org/question/2587/simplify-shenanigans, hash lookup errors then leads to undesirable behavior:
Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/14608
The text was updated successfully, but these errors were encountered: