[Python-ideas] Leave off "else" in ternary expression
Todd
toddrjen at gmail.com
Fri Oct 28 12:02:04 EDT 2016
On Fri, Oct 28, 2016 at 11:36 AM, Bernardo Sulzbach <
mafagafogigante at gmail.com> wrote:
> On 10/28/2016 01:28 PM, Todd wrote:
>
>>
>> The idea would be to allow this syntax:
>>
>> x = a if b
>>
>> Which would be equivalent to:
>>
>> x = a if b else x
>>
>>
> What if x has not been defined yet?
>
>
Same as "x = a if b else x", it would raise a NameError.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161028/142e7328/attachment.html>
More information about the Python-ideas
mailing list