[Python-ideas] PEP 505: None-aware operators

David Mertz mertz at gnosis.cx
Mon Jul 23 10:30:09 EDT 2018


On Mon, Jul 23, 2018 at 5:52 AM Steve Dower <steve.dower at python.org> wrote:

> The PEP author is unsure about how it works
> -------------------------------------------
> I wish this statement had come with some context, because the only thing
> I'm unsure about is what I'm supposed to be unsure about.
>

In general—as I haven't been shy of saying—I find the entire idea awful.  I
recognize you have done sincere and high quality work in arguing for it; it
just feels like a very wrong direction for Python.

But bracketing that, I'm probably the person you have in mind in that
comment.  And it's funny that you write you are unsure what you are
supposed to be unsure about, but the very next section is exactly what I
had in mind.  Of course I don't mean that if implemented the semantics
would be ambiguous... rather, the proper "swallowing" of different kinds of
exceptions is not intuitively obvious, not even to you, Steve.  And if some
decision was reached and documented, it would remain unclear to new (or
even experienced) users of the feature.

I'm borderline on ?[] right now. Honestly, I think it works best if it
> also silently handles LookupError (e.g. for traversing a loaded JSON
> dict), but then it's inconsistent with ?. which I think works best if it
> handles None but allows AttributeError.
>

Moreover, at a couple points in your clarification, you say "ignoring
descriptors." But ultimately, the language cannot do that.  When a
programmer writes `obj?.descriptor?.other_descriptor` SOMETHING has to
happen (no matter what actually happens within the code of the property).

This can certainly be specified in some unambiguous way, but I believe that
any decision made will be strongly counter-intuitive for certain concrete
code.

-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180723/44675656/attachment.html>


More information about the Python-ideas mailing list