On Mar 21, 2007, at 1:38 AM, William Stein wrote:

> That said, we simply can't require
>   (*) "a == b ==> hash(a) == hash(b)"
> in SAGE, because mathematics is simply too complicated for this sort
> of rule.  So what is done in SAGE is to _attempt_ to satisfy (*)  
> when it
> is reasonably easy to do so, but use judgment and not go overboard.
> E.g.,
>    sage: hash(Mod(2,7))
>    2
> I.e., we get 2.  That's better than some weird random hash that also
> involves the moduli, but it's of course not right from the Python  
> point
> of view, since 9 == Mod(2,7).   Long ago before we ever had this
> discussion about hashing, I think Mod(2,7) was the hash of some
> combination of 2 and 7.

The only way we could "fix" this problem for good is to abandon using  
the "==" operator for "SAGE equality", and implement SAGE equality as  
a new method attached to each object. Then we could follow python  
rules for "==" and our rules for everything else, and all SAGE code  
would become completely unreadable (and for that matter unwriteable).  
So I think what you've said above is perfectly reasonable, and we  
just have to live with it.

David


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to