On May 1, 2009, at 2:29 PM, Nicolas M. Thiery wrote: > On Fri, May 01, 2009 at 12:31:40PM -0700, William Stein wrote: >> >> On Fri, May 1, 2009 at 12:16 PM, Robert Bradshaw >> <rober...@math.washington.edu> wrote: >>> >>> On May 1, 2009, at 8:15 AM, kcrisman wrote: >>> >>>>> In the future of python, things that don't have a sensible order >>>>> throw a TypeError when comparing: >>>>> http://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons >>>>> Why don't we just throw an error? >>>> >>>> As for throwing an error, probably that should be done Sage-wide >>>> for >>>> things that don't make sense, not piecemeal. At least I don't feel >>>> comfortable opening that can of worms! >>> >>> Yep, this was opened a while back, and it turned into one of the >>> longest treads ever... I would still like to see conclusion on that. >> >> Despite being a huge thread, the resolution is really easy. I think >> we should do the following: "The ordering comparison operators (<, >> <=, >>> =, >) should raise a TypeError exception when the operands don’t >>> have >> a meaningful natural ordering. Thus, expressions like 1 < '', 0 > >> None >> or len <= len will no longer be valid. A corollary is that sorting a >> heterogeneous list no longer makes sense – all the elements must be >> comparable to each other. Note that this does not apply to the == and >> != operators: objects of different incomparable types will always >> compare unequal to each other." > > +1
There was a lot of other stuff in that thread, but yes, lets do this. > What's not resolved is how much the system should try to be clever > when comparing, e.g., and element of QQ[sqrt(2)] and of QQ[sqrt(3)]. If a + b works, than a < b should be compared in parent(a+b) (which may or may not have an ordering). For the moment, the above would fail. (In fact, QQ[sqrt(a)] doesn't yet come with an embedding...) Another unresolved issue was how to handle RealField(53).pi() == RealField(500).pi() - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---