On Mon, Jun 26, 2017 at 01:23:36PM +1000, Steven D'Aprano wrote: > The downside to this proposal is that it adds some conceptual complexity > to Python operators. Apart from `is` and `is not`, all Python operators > call one or more dunder methods. This is (as far as I know) the first > operator which has fall-back functionality if the dunder methods aren't > defined.
I remembered there is a precedent here. The == operator tries __eq__ before falling back on object identity, at least in Python 2. py> getattr(object(), '__eq__') Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'object' object has no attribute '__eq__' py> object() == object() False -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/