
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/python-dev@python.org/message/BRTRKGY6... Best regards, Piotr On Thu, Sep 15, 2022 at 6:54 PM Maarten Nieber <mnieber@gmail.com> 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 -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/KSKTJRNS... Code of Conduct: http://python.org/psf/codeofconduct/