On Thu, Aug 2, 2018 at 12:04 AM, Jonathan Fine <jfine2...@gmail.com> wrote:
> Hi Steve
>
> Thank you for your reply.
>
> We're discussing the abstract to PEP 505, which writes
>  ===
> The "None-aware attribute access" operator ?. ("maybe dot") evaluates
> the complete expression if the left hand side evaluates to a value
> that is not None
> ===
>
> I gave (42).str as an example. I wrote
>
>> I don't see how to apply the prose in the abstract to this last
>> example. The left hand side is not None, so we "evaluate the complete
>> expression". On one reading, this is a recursion.
>
> You wrote
>> The phrasing could be clearer.
>
> I think the phrasing could be considerably improved (see below).
>
>> Since 42 is not None, it evaluates (42).str
>> [...]
>
> Based on this hint, here's what I think is a better statement.
> ===
> Let `lhs` be the value of the left hand side, and RHS the code
> fragment on the right hand side. If `lhs` is None, then the whole
> expression is `None`. Otherwise, `lhs . RHS` gives the value of the
> whole expression.
> ===
>
> Please would the experts tell me: Is it true? And if true, is it
> better? And can it be improved?

It may be true, but it isn't better IMO - especially not for the
abstract. It's unnecessarily pedantic. The current wording isn't
ambiguous, because infinite recursion makes no sense.

MAYBE change it to "evaluate the rest of the expression", but I don't
see a problem with the current wording.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to