Operators that only vary by case would be... confusing. I'm not super keen on the other syntax (either the ?? or .? operators) but I do think they read well in C# where they come from. Different things work in different languages, some times.
What about a new keyword: default So you'd write the above examples like this: default hi = len(a) # Only executes the assignment if the left-hand is None default encoding = sys.getdefaultencoding() On Thu, Jul 19, 2018 at 9:06 AM, Pål Grønås Drange <paal.dra...@gmail.com> wrote: > > I've started a subthread, just to discuss the ?= and ?? operators. And > > something newish, that I call OR. > > I would think `||` would be much better. > > It could be a kind of "semantic or" which could use the aforementioned > dunder has_value. > > -1, though, but to the general None-awareness. > > Pål > > _______________________________________________ > 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/