Let me just address this point: 2018-07-19 20:36 GMT+02:00 Brendan Barnwell <[email protected]>:
> 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 @.) > I think the actual reason is that it is a short-cutting operator, and none of the shortcutting operators (and, or, if/else) have an associated method. They cannot have, since they induce a non-standard evaluation order, hence their effect cannot be emulated with a method invocation. Stephan
_______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
