[Python-ideas] PEP 505 (None coalescing operators) thoughts

Random832 random832 at fastmail.com
Thu Oct 1 22:37:28 CEST 2015


On Thu, Oct 1, 2015, at 15:48, Steven D'Aprano wrote:
> I don't see what this has to do with null aware attribute access.
> 
> If I wrote:
> 
> (spam?.eggs.cheese).__class__
> 
> the obvious intention is that it should evaluate like:
> 
> temp = spam?.eggs.cheese
> temp.__class__

Why would you need to do that, though? What's the practical use case for
this, that you need to do it frequently enough to want a way to do it
without using a temporary?

Or do you think that, as the thing that it short-circuits to the end of,
"same atom_expr unbroken by parentheses" [a concept which, I remind you,
*does not exist* in AST] is somehow simpler or easier to explain than
"same chain of Attribute/Call/Subscript operations"?


More information about the Python-ideas mailing list