For A and B Parents, should A == B ever differ from A is B?  This came up in
tracking down a p-adics bug, but there's at least one place that assumes the
equivalence of these conditions.  The place I'm thinking of is in
sage.categories.hom_set.Hom, where it checks a cache to see if the Homset
has been computed already.  Finding a key in a dictionary uses ==, but we
require an "is" relation for domains and codomains of maps.

My opinion is that we should strive for (A == B) iff (A is B), so the Hom
function is not a bug as written, and instead I just need to make either one
function smarter or another function dumber in the p-adics code.  But I
thought I'd ask sage-devel, and raise the issue so that people are aware of
this constraint on the __cmp__ method for Parents.
David

P.S.  To find an example of two parents which currently compare as equal but
are not the same object, do
sage: R = Zp(5, print_sep="|")
sage: S = Zp(5, print_sep=":")
sage: R == S
True
sage: R is S
False

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to