Strict comparisons in Python 2

Random832 random832 at fastmail.com
Tue Oct 13 11:24:08 EDT 2015


Ian Kelly <ian.g.kelly at gmail.com> 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, same as division and
the / operator. That'd be a bit heavyweight to do this late in the
Python 2 cycle though.

What might be nice would be a general way to pass in lexical context
information to the methods called to implement operators.

> It may be a good candidate for the six library, but
> I don't see any existing support there for it.




More information about the Python-list mailing list