On Oct 13, 2015 7:48 AM, "Steven D'Aprano" <st...@pearwood.info> wrote:
>
> In Python 3, comparisons between arbitrary types raise TypeError:
>
> py> None < 2
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unorderable types: NoneType() < int()
>
>
> In Python 2, that same comparison will arbitrarily return True or False,
> according to some implementation-dependent rule.
>
> Is there some way to force the Python 3 rules into Python 2? Something
like
> a __future__ import?

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. It may be a good candidate for the six library, but I don't
see any existing support there for it.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to