On Tue, Jan 24, 2017 at 3:26 AM, Erik Bray <erik.m.b...@gmail.com> wrote:
> To be clear, while Python 3 got rid of comparisons between built-in > types that were ill-defined, that doesn't prevent one from > implementing comparisons between one's own types however we want: If I were doing the Python3 port (and I'm not, so take this with a grain of salt), I would very likely just get it done keeping the current behavior as much as possible. Then, once we're happily using Python 3, I might start considering changing the semantics of Sage (which of course will definitely break some people's code). -- William > > Python 3.4.5 (default, Oct 10 2016, 14:41:48) > [GCC 5.4.0] on cygwin > Type "help", "copyright", "credits" or "license" for more information. >>>> class myint(int): > ... def __lt__(self, other): > ... if isinstance(other, str): > ... return True > ... return super().__lt__(other) > ... >>>> 1 < "x" > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > TypeError: unorderable types: int() < str() >>>> myint(1) < "x" > True > > -- > 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 sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.