[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021年10月23日 06:42:14 -0700

> Bear in mind that these last ones are exactly equivalent to the "or"
> operator, as they'll use the default if you have any falsy value.
> variable = some_function(...) or []
Isn't that in itself a good argument in favor of (??) ? By missing to add 'is 
None', I would have already added a subtle bug that could be quite difficult to 
find. (??) could prevent that while also being more readable.
> I'm actually more interested in a better idiom for non-constant
> function default arguments, since that's the place where this kind of
> thing often comes up. A nice ??= operator might help if your default
> is None, but if you then change the default to be object(), you can't
> use ??= any more. [...]
True, but from my experience 'None' is just by far the most common default. Why 
not improve how we handle it?
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/VDMN5ZHPMMBLCHVM63RROZJYAIII74A3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to