[Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

Stephan Houben stephanh42 at gmail.com
Wed Nov 29 07:38:26 EST 2017


What about more English-like syntax:

X or else Y

E.g.

cache.get(foo) or else expensive_call(foo)

Stephan


Op 29 nov. 2017 12:54 schreef "Serhiy Storchaka" <storchaka at gmail.com>:

29.11.17 11:45, Steven D'Aprano пише:

On Wed, Nov 29, 2017 at 09:14:12AM +0200, Serhiy Storchaka wrote:
>
>> 29.11.17 08:08, Steven D'Aprano пише:
>>
>>> Perl is hardly the only language with null-coalescing operators -- we
>>> might better describe ?? as being familiar to C#, PHP, Swift and Dart.
>>> That's two mature, well-known languages and two up-and-coming languages.
>>>
>>
>> What is the syntax of the ternary operator in these languages?
>>
>
> All four use:
>
>      condition ? first : second
>
> for the ternary if operator.
>

If all four use ?, it is natural that in operators which are shortcuts of
the ternary operator they use ?. But in Python the bar of introducing ? is
higher.


_______________________________________________
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/20171129/025f41b9/attachment-0001.html>


More information about the Python-ideas mailing list