[Python-ideas] Null coalescing operator

Chris Angelico rosuav at gmail.com
Tue Nov 1 23:09:24 EDT 2016


On Wed, Nov 2, 2016 at 11:09 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> I don't know when I would ever want to actually do this in practice, but
> allowing the ?. operator to magically effect code outside of the
> parentheses definitely counts as "spooky action at a distance". Guido's
> rule of "everything to the right" is easy to reason about if "to the
> right" ends where the parenthised expression ends.
>

We already expect "to the left" and "to the right" to end based on
operator precedence rules. Parentheses are used to control operator
precedence. It would surprise people *greatly* if they didn't bound
the effect of the question mark.

ChrisA


More information about the Python-ideas mailing list