[Python-ideas] Null coalescing operators

Guido van Rossum guido at python.org
Mon Sep 21 19:07:16 CEST 2015


On Mon, Sep 21, 2015 at 8:58 AM, Mark E. Haase <mehaase at gmail.com> wrote:

> PEP-505 isn't anywhere close to being finished. I only submitted the draft
> because somebody off list asked me to send a draft so I could get a PEP
> number assigned. So I literally sent him what I had open in my text editor,
> which was just a few minutes of brain dumping and had several mistakes
> (grammatical and technical).
>
> If there's absolutely no point in continuing to work on it, I'll drop it.
> But from the outset, I thought the plan was to present this in its best
> light (and similar to the ternary operator PEP, offer several alternatives)
> if for no other reason than to have a good record of the reasoning for
> rejecting it.
>
> I'm sorry if I misunderstood the PEP process; I would have kept it to
> myself longer if I knew the first submission was going to be reviewed
> critically. I thought this e-mail chain was more of an open discussion on
> the general idea, not specifically a referendum on the PEP itself.
>

I apologize for having misunderstood the status of your PEP. I think it
would be great if you finished the PEP. As you know the ? operator has its
share of fans as well as detractors, and I will happily wait until more of
a consensus appears. I hope you can also add a discussion to the PEP of
ideas (like some of the hyper-generalizations) that were considered and
rejected -- summarizing a discussion is often a very important goal of a
PEP. I think you have made a great start already!

--Guido


> On Mon, Sep 21, 2015 at 11:40 AM, Guido van Rossum <guido at python.org>
> wrote:
>
>> Just to cut this thread short, I'm going to reject PEP 505, because ? is
>> just too ugly to add to Python IMO. Sorry.
>>
>> I commend Mark for his clean write-up, without being distracted, giving
>> some good use cases. I also like that he focused on a minimal addition to
>> the language and didn't get distracted by hyper-generalizations.
>>
>> I also like that he left out f?(...) -- the use case is much weaker;
>> usually it's the object whose method you're calling that might be None, as
>> in title?.upper().
>>
>> Some nits for the PEP:
>>
>> - I don't think it ever gives the priority for the ?? operator. What
>> would "a ?? b or c" mean?
>> - You don't explain why it's x ?? y but x ?= y. I would have expected
>> either x ? y or x ??= y.
>> - You don't explain or show how far ?. reaches; I assume x?y.z is
>> equivalent to None if x is None else x.y.z, so you don't have to write
>> x?.y?.z just to handle x.y.z if x is None.
>> - The specification section is empty.
>>
>> --
>> --Guido van Rossum (python.org/~guido)
>>
>
>
>
> --
> Mark E. Haase
> 202-815-0201
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150921/d3af7f7d/attachment.html>


More information about the Python-ideas mailing list