Re: Strict comparisons in Python 2

2015-10-13 Thread Terry Reedy
On 10/13/2015 9:43 AM, Steven D'Aprano wrote: In Python 3, comparisons between arbitrary types raise TypeError: py> None < 2 Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: NoneType() < int() In Python 2, that same comparison will arbitrarily return Tru

Re: Strict comparisons in Python 2

2015-10-13 Thread Ian Kelly
On Tue, Oct 13, 2015 at 9:24 AM, Random832 wrote: > Ian Kelly writes: >> You couldn't do this with a __future__ import because those must be >> confined to the importing module and are therefore generally limited >> to syntax changes. > > In principle, it could be a syntax change to the < operato

Re: Strict comparisons in Python 2

2015-10-13 Thread Random832
Ian Kelly writes: > You couldn't do this with a __future__ import because those must be > confined to the importing module and are therefore generally limited > to syntax changes. In principle, it could be a syntax change to the < operator (etc) to cause it to try to call a different method first

Re: Strict comparisons in Python 2

2015-10-13 Thread Ian Kelly
On Oct 13, 2015 7:48 AM, "Steven D'Aprano" wrote: > > In Python 3, comparisons between arbitrary types raise TypeError: > > py> None < 2 > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: NoneType() < int() > > > In Python 2, that same comparison will arb

Strict comparisons in Python 2

2015-10-13 Thread Steven D'Aprano
In Python 3, comparisons between arbitrary types raise TypeError: py> None < 2 Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: NoneType() < int() In Python 2, that same comparison will arbitrarily return True or False, according to some implementation-depe