On Sun, Jul 25, 2010 at 6:50 PM, Robert Miller <r...@rlmiller.org> wrote: > On Sun, Jul 25, 2010 at 8:10 PM, Carl Witty <carl.wi...@gmail.com> wrote: >> You seem to want to make the vertex dictionary respect the equivalence >> relation defined by Sage equality. If so, you're going to be in >> trouble, since Sage equality actually is not an equivalence relation:
It gets worse: sage: a = Set([1,2,3]) sage: b = Set([2,3,4]) sage: a < b True sage: b > a False sage: b < a True sage: a > b False Let's take a look at Sage's implementation of comparison: sage: a.__cmp__?? ... if isinstance(other, Set_object_enumerated): if self.set() == other.set(): return 0 return -1 else: return Set_object.__cmp__(self, other) Aduuhhhh! If it is not true that a == b, then a < b. Not good. I would like to ask, since obviously nobody cares about doing comparisons with Sage sets at the moment... We obviously need to define what it means for a < b and a > b for Sage Sets. Does anyone mind if we do this so that instead of < meaning subset, and getting a bad ordering with respect to sorting lists, can we make < give a lexicographic ordering? I will gladly do all the work, including implementing an is_subset method. That way, if you like working with sets themselves and you want < to mean subset, simply use Python sets. Or if you are Chris Godsil, e.g., and like to be able to consistently sort sets because you use them as vertices for graphs, use Sage Sets. I think this is the best solution we can get to this problem... -- Robert L. Miller http://www.rlmiller.org/ -- 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