On Mon, Dec 05, 2016 at 08:04:11AM +0100, Jeroen Demeyer wrote:
> On 2016-12-04 19:39, Marc Mezzarobba wrote:
> >Hi,
> >
> >Does Element.__richcmp__() (via CoercionModel_cache_maps.richcmp())
> >really need to fall back on comparing by type/id when no common parent
> >is found?
> 
> No. As far as I know, It does so for historical reasons only. I am in favour
> of making elements without a common parent uncomparable.

Note that there are not only "mathemathical" orderings, but also
"algorithmic" ones. It is useful (and i bet assumed in various Sage
algorithms) to be able to totally order any pair of Python objects, e.g.
when you want to traverse a graph, or even identify edges:

sage: Graph({2:['a']}).edges(labels=False)
[(2, 'a')]
sage: Graph({'a':[2]}).edges(labels=False)
[(2, 'a')]
sage: 2 < 'a'
True

I guess we can try to use equality test and `id()` for such a purpose, but
it might force us to change a lot of code.

Ciao,
Thierry

 
> -- 
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to