[Python-ideas] [Python-ideos] Dedicated overloadable boolean operators
Guido van Rossum
guido at python.org
Tue Nov 24 14:51:46 EST 2015
On Tue, Nov 24, 2015 at 11:37 AM, Nathaniel Smith <njs at pobox.com> wrote:
> On Nov 24, 2015 10:21 AM, "Guido van Rossum" <guido at python.org> wrote:
>>
>> To everyone claiming that you can't overload and/or because they are
>> shortcut operators, please re-read PEP 335. It provides a clean
>> solution -- it was rejected because it adds an extra byte code to all
>> code using those operators (the majority of which don't need it).
>
> The semantic objection that I raised -- short circuiting means that you
> can't correctly overload 'True and numpy_array', because unlike all other
> binops the overload must be defined on the left hand argument -- does apply
> to PEP 335 AFAICT. This problem is IMHO serious enough that even if PEP 335
> were accepted today I'm not entirely sure that numpy would actually
> implement the overloads due to the headaches it would cause for teaching and
> code review -- we'd have to have some debate about it at least.
OK, that's useful feedback. Is NumPy interested in coming up with an
alternative that works, or are you fine with the status quo?
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list