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

Piotr Waszkiewicz <[email protected]> Thu, 15 Sep 2022 19:57:51 +0200
Newsgroups gmane.comp.python.devel
Message-ID <CA+UBZdVNeaZ1VrU=unJFfDLimqdw3xn9x3kyqTyA0JNy_gWwAw@mail.gmail.com>
Hi Maarten,
I'm sorry for the confusion - it was bad wording on my part.
What I really meant was that the problem with the None-aware operator, and
the reason why PEP505 has not been accepted for such a long time, is that
there's no consensus regarding the need for it (and not necessarily the
problem with the operator used to represent it - although this topic has
also been raised).

Take a look at the response by Steve Dower:
https://mail.python.org/archives/list/[email protected]/message/BRTRKGY6RLTHZJQ2US4LO7DYLSGXQ5GM/

Best regards,
Piotr

On Thu, Sep 15, 2022 at 6:54 PM Maarten Nieber <[email protected]> wrote:

> Hi Piotr,
>
> doesn't Doug's reply of 8:03 address this point? As he says, the
> none-aware operator never gives you None when you ask for a missing
> attribute (these cases always raise an exception). If we look at these two
> alternatives
>
> phone1 = book.publisher?.owner.phone
> phone2 = book.publisher.owner.phone if book.publisher else None
>
> then they behave exactly the same. If we would misspell "owner" then in
> both versions we'd get the same AttributeError under the same conditions.
>
> Best,
> Maarten
> _______________________________________________
> 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/KSKTJRNSQSBRYZRY6QQY7B3TZ5J4P2PD/
> Code of Conduct: http://python.org/psf/codeofconduct/
>