Hi, I'm currently wrapping FLINT fq modules into new Sage classes for finite fiels and got strange coercion errors when running non trivial code. Indeed, the polynomial ring constructors use a dictionary and so relies on the hash of finite fields (the parents). By some chance, the hashes of two previous implementations of finite fields using PARI where different because some variable name was replaced by something else in some object and this prevented this problem to occur.
I read http://www.sagemath.org/doc/developer/coding_in_python.html#the-hash-special-method but would welcome any advice. Though (non-prime) finite fields with the same order and defining polynomial are considered equal, I'd say the hashes should be different. So, let's add the string of the implementation of the finite field into it's hash (which is cached by the way). Does that seem sensible? Or should I modify the finite field code so that these hashes are equal whatever the implementation is? Then we'd need coercion between all of the implementations (which is not currently the case but should be done anyway), but that would surely yield a non-negligible speed penalty, and you'll never know what the implementation of the base ring of the polynomial ring will be as it will depend on the order finite fields and their polynomial rings are created. Or should we modify the caching system of the polynomial rings not to use hashes but ids? Best, JP -- 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/d/optout.