Hi! I think I understood how - in the concrete example - comparison works: We have two elements v,w of a free module M that are defined over the same base field. Actually v.parent() is a sub-module S of M, while w.parent() is M. Now, FreeModuleElement.__richcmp__ (which is not the default metho of parents) finds out that the base fields are the same, and then calls a method that compares the coefficient lists of v and w.
"Comparing the coefficient lists if the base fields of the parents are the same" is in fact a shortcut for coercion: If the coefficient lists have the same length and the base fields are the same then in fact v and w belong to the same ambient space (here: M), and it makes sense to compare there. I expect that this custom comparison shortcut is in fact faster than the default comparison, which would be: Test if there is a coercion between the parents, or try to construct the pushout; convert both elements into the common parent; compare the coefficient lists. Hence, the default is an explicit conversion to M, but comparing the lists right away (after testing that the base fields are the same) does the same implicitly. So, I think I won't touch the custom comparison, here. Cheers, Simon -- 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