
The way I recall it, we arrived at the perfect syntax (using ?) and semantics. The issue was purely strong hesitation about whether sprinkling ? all over your code is too ugly for Python, and in the end we couldn't get agreement on *that*. Another problem is PEP 505 -- it is full of discussion but its specification is unreadable due to the author's idea to defer the actual choice of operators and use a strange sequence of unicode characters instead. If someone wants to write a new, *short* PEP that defers to PEP 505 for motivation etc. and just writes up the spec for the syntax and semantics we'll have a better starting point. IMO the key syntax is simply one for accessing attributes returning None instead of raising AttributeError, so that e.g. `foo?.bar?.baz` is roughly equivalent to `foo.bar.baz if (foo is not None and foo.bar is not None) else None`, except evaluating foo and foo.bar only once. On Sat, Sep 10, 2016 at 10:14 AM, Random832 <random832@fastmail.com> wrote:
On Sat, Sep 10, 2016, at 12:48, Stephen J. Turnbull wrote:
I forget if Guido was very sympathetic to null-coalescing operators, given somebody came up with a good syntax.
As I remember the discussion, I thought he'd more or less conceded on the use of ? but there was disagreement on how to implement it that never got resolved. Concerns like, you can't have a?.b return None because then a?.b() isn't callable, unless you want to use a?.b?() for this case, or some people wanted to have "a?" [where a is None] return a magic object whose attribute/call/getitem would give no error, but that would have to keep returning itself and never actually return None for chained operators. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido)