What could perhaps be added is some kind of a normalization routine
(to be implemented by subclasses) that is called before performing a
hash. This might be quite expensive. There's also some fuzziness about
what equality should be used, e.g. is this OK?

sage: S = set([(x+1)^2])
sage: x^2 + 2*x + 1 in S
False

That really depends on what you want.


On Wed, Aug 28, 2013 at 2:38 PM, Stefan <stefanvanz...@gmail.com> wrote:
> I ran into the following issue:
>
> sage: H5.<a,b,c> = FractionField(PolynomialRing(ZZ, ['a', 'b', 'c']))
> sage: S = set([1/(1-c)])
> sage: (-1)/(c-1) in S
> False
>
> I know Sage doesn't promise that equal objects have equal hashes, but surely 
> this should be valid for objects from *a single ring*?
>
> I looked at the hash function implementation, and it's not straightforward to 
> fix this, since it's the generic FractionField method. In particular, we can 
> assume nothing about the ring on which the FractionField is based. I can come 
> up with some examples of rings, and try to do something for them, but my 
> imagination is kind of limited. Subclassing FractionField feels like 
> overkill, but a long list of try... Except clauses inside __hash__ is bad too.
>
> Thoughts?
>
> --Stefan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to