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" <random...@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@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/