[Python-ideas] PEP 505: None-aware operators

Elazar elazarg at gmail.com
Thu Jul 19 14:43:29 EDT 2018


On Thu, Jul 19, 2018 at 11:37 AM Brendan Barnwell <brenbarn at brenbarn.net>
wrote:

>
>         As far as I can see, these null-coalescing operators would break
> that
> model.  The PEP doesn't seem to provide for a "real" magic method
> allowing users to override the actual behavior of the method.  (You can
> only override __has_value__ to hook into it, but not define by fiat what
> A ?? B does, as you can with other operators.)  And I think the reason
> for this is that the operator itself is too specific, much more specific
> in semantics than other operators.  (I had similar doubts about adding
> the matrix-multiplication operator @.)
>

It is just as specific as the `is` operator, and for the same reason.

Elazar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180719/705902cf/attachment-0001.html>


More information about the Python-ideas mailing list