[Python-ideas] "else" expression ":"
Serhiy Storchaka
storchaka at gmail.com
Sun Apr 14 13:58:49 CEST 2013
On 13.04.13 22:21, Terry Jan Reedy wrote:
> On 4/13/2013 2:24 PM, Peter Norvig wrote:
>> Beginners will often write code like this:
>>
>> if val > 0:
>> return +1
>> elif val < 0:
>> return -1
>> elif val == 0:
>> return 0
>
> So might a Python expert who knows that all three tests could return
> False for instances of some class. For instance, a fuzzy zero, or an
> interval that includes 0.
Or float('nan').
More information about the Python-ideas
mailing list