[Python-ideas] PEP 505: None-aware operators: operators ?= and ?? and OR

Eric Fahlgren ericfahlgren at gmail.com
Thu Aug 2 17:49:24 EDT 2018


On Thu, Aug 2, 2018 at 1:22 PM MRAB <python at mrabarnett.plus.com> wrote:

> > policy?.mangle_from_ ?? True
> > True (??? since lhs is None?)
> >
> No, it's not 'policy.mangle_from_' that could be None, it's 'policy'
> that could be None (i.e. there's no policy).
>

In my example, there is a policy, and the value of policy.mangle_from_ is
set to None.  Thus the above should be equivalent to this

>>> None ?? True
True

Unless, of course, I completely misunderstand the way the ?? operator
works.  This is not the same as the original code, they are not equivalent.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180802/a071dce8/attachment-0001.html>


More information about the Python-ideas mailing list