Rolando Espinoza La Fuente a écrit :
On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
Arnaud Delobelle wrote:
1 == True
True
0 == False
True
So what's your question?
Well nothing I'm just kind of bewildered: I'd expect smth like that in Perl,
but not in Python.. Although I can understand the ra
On 2010-03-05 17:48 PM, Jack Diederich wrote:
On Fri, Mar 5, 2010 at 6:09 PM, Steven D'Aprano
wrote:
On Fri, 05 Mar 2010 15:58:01 -0500, Jack Diederich wrote:
So, the pythonic way to check for True/False should be:
1 is True
False
Why do you need to check for True/False?
You should n
On Fri, Mar 5, 2010 at 1:51 PM, Terry Reedy wrote:
> On 3/5/2010 1:54 PM, Jean-Michel Pichavant wrote:
>> Steven D'Aprano wrote:
>
>> Despite there are good reasons for bool to be int, the newcomer 'wtf'
>> reaction at first glance is legitimate.
>> Starting python from scratch, booleans would hav
On Fri, Mar 5, 2010 at 6:09 PM, Steven D'Aprano
wrote:
> On Fri, 05 Mar 2010 15:58:01 -0500, Jack Diederich wrote:
>
So, the pythonic way to check for True/False should be:
>>> 1 is True
False
>>>
>>> Why do you need to check for True/False?
>>>
>>>
>> You should never check for
On Fri, 05 Mar 2010 15:58:01 -0500, Jack Diederich wrote:
>>> So, the pythonic way to check for True/False should be:
>>>
>> 1 is True
>>> False
>>
>> Why do you need to check for True/False?
>>
>>
> You should never check for "is" False/True but always check for
> equality. The reason is tha
On 2010-03-05 14:58 PM, Jack Diederich wrote:
On Fri, Mar 5, 2010 at 2:54 PM, Steven D'Aprano
wrote:
On Fri, 05 Mar 2010 15:01:23 -0400, Rolando Espinoza La Fuente wrote:
On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
Arnaud Delobelle wrote:
1 == True
True
0 == False
True
So what's you
On 3/5/2010 1:54 PM, Jean-Michel Pichavant wrote:
Steven D'Aprano wrote:
Despite there are good reasons for bool to be int, the newcomer 'wtf'
reaction at first glance is legitimate.
Starting python from scratch, booleans would have not been a subclass of
int (just guessing though), 'cause it
On 3/5/2010 1:30 PM, MRAB wrote:
mk wrote:
>>> isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
>>>
>>> issubclass(bool, int)
True
Huh?!
Python didn't have Booleans originally, 0 and 1 were used instead. When
bool wa
On Fri, Mar 5, 2010 at 2:54 PM, Steven D'Aprano
wrote:
> On Fri, 05 Mar 2010 15:01:23 -0400, Rolando Espinoza La Fuente wrote:
>
>> On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
>>> Arnaud Delobelle wrote:
>>>
>>> 1 == True
True
>>>
>>> 0 == False
True
So wha
On Fri, 05 Mar 2010 15:01:23 -0400, Rolando Espinoza La Fuente wrote:
> On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
>> Arnaud Delobelle wrote:
>>
>> 1 == True
>>>
>>> True
>>
>> 0 == False
>>>
>>> True
>>>
>>> So what's your question?
>>
>> Well nothing I'm just kind of bewildered: I'd
Rolando Espinoza La Fuente wrote:
Doesn't have side effects not knowing that False/True are ints?
It does, in fact I was wondering why my iterator didn't work until I
figured issubclass(bool, int) is true.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Mar 5, 2010 at 2:32 PM, mk wrote:
> Arnaud Delobelle wrote:
>
> 1 == True
>>
>> True
>
> 0 == False
>>
>> True
>>
>> So what's your question?
>
> Well nothing I'm just kind of bewildered: I'd expect smth like that in Perl,
> but not in Python.. Although I can understand the rat
Steven D'Aprano wrote:
On Fri, 05 Mar 2010 18:14:16 +0100, mk wrote:
isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
Yes. Do you have an actual question?
>>> issubclass(bool, int)
True
Huh?!
Exactly.
Arnaud Delobelle wrote:
1 == True
True
0 == False
True
So what's your question?
Well nothing I'm just kind of bewildered: I'd expect smth like that in
Perl, but not in Python.. Although I can understand the rationale after
skimming PEP 285, I still don't like it very much.
Regards,
mk
mk wrote:
>>> isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
>>>
>>> issubclass(bool, int)
True
Huh?!
Python didn't have Booleans originally, 0 and 1 were used instead. When
bool was introduced it was made a su
On Fri, Mar 5, 2010 at 2:00 PM, Steve Holden wrote:
[...]
>
> Just a brainfart from the BDFL - he decided (around 2.2.3, IIRC) that it
> would be a good ideal for Booleans to be a subclass of integers.
>
I would never figured out
>>> bool.__bases__
(,)
Doesn't have side effects not knowing tha
On Fri, 05 Mar 2010 18:14:16 +0100, mk wrote:
>>>> isinstance(False, int)
> True
> >>>
> >>> isinstance(True, int)
> True
>
> Huh?
Yes. Do you have an actual question?
> >>> issubclass(bool, int)
> True
>
>
On Fri, Mar 5, 2010 at 9:14 AM, mk wrote:
> >>> isinstance(False, int)
> True
> >>>
> >>> isinstance(True, int)
> True
>
> Huh?
>
> >>>
> >>> issubclass(bool, int)
> True
>
> Huh?!
>
Huh, what?
http://ww
mk writes:
>>>> isinstance(False, int)
> True
>>>>
>>>> isinstance(True, int)
> True
>
> Huh?
>
>>>>
>>>> issubclass(bool, int)
> True
>
> Huh?!
>
> Regards,
> mk
Yes, and:
>>> True + Fa
mk wrote:
>>>> isinstance(False, int)
> True
>>>>
>>>> isinstance(True, int)
> True
>
> Huh?
>
>>>>
>>>> issubclass(bool, int)
> True
>
> Huh?!
>
>>> 3+True
4
>>> 3+False
3
>>>
J
>>> isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
>>>
>>> issubclass(bool, int)
True
Huh?!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
21 matches
Mail list logo