[Python-ideas] PEP 505 (None coalescing operators) thoughts

Rob Cliffe rob.cliffe at btinternet.com
Thu Oct 1 04:08:47 CEST 2015



On 30/09/2015 23:57, Sven R. Kunze wrote:
> On 30.09.2015 13:00, Rob Cliffe wrote:
>> Or:
>>     x = a orelse b        # Visual Basic has a short-circuiting 
>> OrElse operator for boolean operands
>>     x = a orifNone b
>>
>>
>> On 30/09/2015 01:39, Ryan Gonzalez wrote:
>>> What about 'otherwise'?
>>>
>>> x = a otherwise b
>>>
>
>
> The only reason why I would prefer "else" over the proposed 
> alternatives: it's already a reserved keyword and it's not really 
> necessary to waste another one. Otherwise, I don't care too much.
>
> Best,
> Sven
Are you suggesting that "a else b" is a possibility?
That's a no-no because
     a if b else c else d
is ambiguous; it could mean either of
     a if b else (c else d)
     (a if b else c) else d
Rob

>
>
> _______________________________________________
> 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/20151001/67c361ef/attachment.html>


More information about the Python-ideas mailing list