[Python-ideas] Null coalescing operator

Ryan Gonzalez rymg19 at gmail.com
Sat Sep 10 18:24:37 EDT 2016


https://github.com/kirbyfan64/_frozensafemockobjectimplementation

In all seriousness, though, I really feel like that would be the ultimate
bug magnet, since it'd be easy to forget to un-wrap the object afterwards.

--
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/
On Sep 10, 2016 5:21 PM, "David Mertz" <mertz at gnosis.cx> wrote:

> I find the '?.' syntax very ugly, much more so in the examples of chained
> attributes.
>
> A much better way to handle the use case is to wrap objects in a class
> that gives this "propagating None" behavior with plain attribute access. A
> nice implementation was presented in this thread.
>
> On Sep 10, 2016 3:16 PM, "Random832" <random832 at fastmail.com> wrote:
>
>> On Sat, Sep 10, 2016, at 13:26, Guido van Rossum wrote:
>> > 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
>>
>> I think that if there's "strong hesitation" about something being "too
>> ugly" it can't really be described as "the perfect syntax". IIRC there
>> were a couple alternatives being discussed that would have reduced the
>> number of question marks to one [or one per object which might be None].
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160910/77e10c65/attachment.html>


More information about the Python-ideas mailing list