David Raymond writes:
>> This is true. I have written 0 as false in C so many times. But
>> clearly for me times have changed... I now look at numbers as a thing
>> in their own special class not to be confused as truth-values. (So much
>> so that I fell for this.) But I confess I still thin
> This is true. I have written 0 as false in C so many times. But
> clearly for me times have changed... I now look at numbers as a thing
> in their own special class not to be confused as truth-values. (So much
> so that I fell for this.) But I confess I still think of numbers as all
> TRUE
Chris Angelico writes:
[...]
>> Anyway, I kind of replied just to thank you all for the great group this
>> is. ChrisA, I don't know how can keep up with this newsgroup, but you
>> do. This is crazy. Years go by and when I come back, there you are
>> still. You're priceless.
>
> You're most
On Sun, Jun 21, 2020 at 10:06 AM Boris Dorestand wrote:
>
> Chris Angelico writes:
> > Zero being false shouldn't be a surprise. If None can count as false,
> > then so should other "emptiness" values. (Remember, the canonical
> > falseness value is False, not None.)
>
> This is true. I have wri
Chris Angelico writes:
> On Sun, Jun 21, 2020 at 2:02 AM Boris Dorestand
> wrote:
>>
>> I just wrote
>>
>> def f(y, N, k = None):
>> k = k or (N - 1)
>> return k
>>
>> I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.
>>
>> I'd like 0 to be a valid choice for k.
>>
>>
Le 20/06/2020 à 18:23, Stefan Ram a écrit :
Boris Dorestand writes:
def f(y, N, k = None):
k = k or (N - 1)
return k
I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.
bool is a subtype of int.
I'd like 0 to be a valid choice for k.
k = N-1 if k==None else k
On Sun, Jun 21, 2020 at 2:02 AM Boris Dorestand wrote:
>
> I just wrote
>
> def f(y, N, k = None):
> k = k or (N - 1)
> return k
>
> I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.
>
> I'd like 0 to be a valid choice for k.
>
> How do you guys let k be an optional argu