<div dir="ltr">For what it's worth, I like the C# syntax with question marks.<div><br></div><div>It is probably more risky (breaks more code) to introduce a new keyword than a new symbol as operator.</div><div><br></div><div>If we have to pick a symbol, it's less confusing if we pick something another language already uses. There is no shame in copying from other languages. Many of them copy ideas from Python as well ;-)</div><div><br></div><div>Thanks.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 October 2016 at 17:10, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I actually think the spelling is the main stumbling block. The<br>
intrinsic value of the behavior is clear, it's finding an acceptable<br>
spelling that hold back the proposal.<br>
<br>
I propose that the next phase of the process should be to pick the<br>
best operator for each sub-proposal. Then we can decide which of the<br>
sub-proposals we actually want in the language, based on a combination<br>
of how important the functionality is and how acceptable we find the<br>
spelling.<br>
<span class="HOEnZb"><font color="#888888"><br>
--Guido<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Oct 13, 2016 at 8:20 PM, Mark E. Haase <<a href="mailto:mehaase@gmail.com">mehaase@gmail.com</a>> wrote:<br>
> (Replying to multiple posts in this thread)<br>
><br>
> Guido van Rossum:<br>
>><br>
>> Another problem is PEP 505 -- it<br>
>> is full of discussion but its specification is unreadable due to the<br>
>> author's idea to defer the actual choice of operators and use a<br>
>> strange sequence of unicode characters instead.<br>
><br>
><br>
> Hi, I wrote PEP-505. I'm sorry that it's unreadable. The choice of emoji as<br>
> operators was supposed to be a blatant joke. I'd be happy to submit a new<br>
> version that is ASCII. Or make any other changes that would facilitate<br>
> making a decision on the PEP.<br>
><br>
> As I recall, the thread concluded with Guido writing, "I'll have to think<br>
> about this," or something to that effect. I had hoped that the next step<br>
> could be a survey where we could gauge opinions on the various possible<br>
> spellings. I believe this was how PEP-308 was handled, and that was a very<br>
> similar proposal to this one.<br>
><br>
> Most of the discussion on list was really centered around the fact that<br>
> nobody like the proposed ?? or .? spellings, and nobody could see around<br>
> that fact to consider whether the feature itself was intrinsically valuable.<br>
> (This is why the PEP doesn't commit to a syntax.) Also, as unfortunate side<br>
> effect of a miscommunication, about 95% of the posts on this PEP were<br>
> written _before_ I submitted a complete draft and so most of the<br>
> conversation was arguing about a straw man.<br>
><br>
> David Mertz:<br>
>><br>
>> The idea is that we can easily have both "regular" behavior and None<br>
>> coalescing just by wrapping any objects in a utility class... and WITHOUT<br>
>> adding ugly syntax. I might have missed some corners where we would want<br>
>> behavior wrapped, but those shouldn't be that hard to add in principle.<br>
><br>
><br>
> The biggest problem with a wrapper in practice is that it has to be<br>
> unwrapped before it can be passed to any other code that doesn't know how to<br>
> handle it. E.g. if you want to JSON encode an object, you need to unwrap all<br>
> of the NullCoalesce objects because the json module wouldn't know what to do<br>
> with them. The process of wrapping and unwrapping makes the resulting code<br>
> more verbose than any existing syntax.<br>
>><br>
>> How much of the time is a branch of the None check a single fallback value<br>
>> or attribute access versus how often a suite of statements within the<br>
>> not-None branch?<br>
>><br>
>> I definitely check for None very often also. I'm curious what the<br>
>> breakdown is in code I work with.<br>
><br>
> There's a script in the PEP-505 repo that can you help you identify code<br>
> that could be written with the proposed syntax. (It doesn't identify blocks<br>
> that would not be affected, so this doesn't completely answer your<br>
> question.)<br>
><br>
> <a href="https://github.com/mehaase/pep-0505/blob/master/find-pep505.py" rel="noreferrer" target="_blank">https://github.com/mehaase/<wbr>pep-0505/blob/master/find-<wbr>pep505.py</a><br>
><br>
> The PEP also includes the results of running this script over the standard<br>
> library.<br>
><br>
> On Sat, Sep 10, 2016 at 1:26 PM, Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> wrote:<br>
>><br>
>> The way I recall it, we arrived at the perfect syntax (using ?) and<br>
>> semantics. The issue was purely strong hesitation about whether<br>
>> sprinkling ? all over your code is too ugly for Python, and in the end<br>
>> we couldn't get agreement on *that*. Another problem is PEP 505 -- it<br>
>> is full of discussion but its specification is unreadable due to the<br>
>> author's idea to defer the actual choice of operators and use a<br>
>> strange sequence of unicode characters instead.<br>
>><br>
>> If someone wants to write a new, *short* PEP that defers to PEP 505<br>
>> for motivation etc. and just writes up the spec for the syntax and<br>
>> semantics we'll have a better starting point. IMO the key syntax is<br>
>> simply one for accessing attributes returning None instead of raising<br>
>> AttributeError, so that e.g. `foo?.bar?.baz` is roughly equivalent to<br>
>> `foo.bar.baz if (foo is not None and foo.bar is not None) else None`,<br>
>> except evaluating foo and foo.bar only once.<br>
>><br>
>> On Sat, Sep 10, 2016 at 10:14 AM, Random832 <<a href="mailto:random832@fastmail.com">random832@fastmail.com</a>><br>
>> wrote:<br>
>> > On Sat, Sep 10, 2016, at 12:48, Stephen J. Turnbull wrote:<br>
>> >> I forget if Guido was very sympathetic to null-coalescing operators,<br>
>> >> given somebody came up with a good syntax.<br>
>> ><br>
>> > As I remember the discussion, I thought he'd more or less conceded on<br>
>> > the use of ? but there was disagreement on how to implement it that<br>
>> > never got resolved. Concerns like, you can't have a?.b return None<br>
>> > because then a?.b() isn't callable, unless you want to use a?.b?() for<br>
>> > this case, or some people wanted to have "a?" [where a is None] return a<br>
>> > magic object whose attribute/call/getitem would give no error, but that<br>
>> > would have to keep returning itself and never actually return None for<br>
>> > chained operators.<br>
>> > ______________________________<wbr>_________________<br>
>> > Python-ideas mailing list<br>
>> > <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
>> > <a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
>> > Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> --Guido van Rossum (<a href="http://python.org/~guido" rel="noreferrer" target="_blank">python.org/~guido</a>)<br>
>> ______________________________<wbr>_________________<br>
>> Python-ideas mailing list<br>
>> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
>> Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
--Guido van Rossum (<a href="http://python.org/~guido" rel="noreferrer" target="_blank">python.org/~guido</a>)<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Gustavo J. A. M. Carneiro<div>Gambit Research<br>"The universe is always one step beyond logic." -- Frank Herbert</div></div></div>
</div>