clp2 at rebertia.com
Sat Mar 6 01:18:29 CET 2010
On Fri, Mar 5, 2010 at 1:51 PM, Terry Reedy <tjreedy at udel.edu> 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 have not been a subclass of
>> int (just guessing though), 'cause it makes no sense from a design POV.
> You are just guessing. I would argue for what we have. An example of its
>>>> scores =[True, False, True, True, False]
>>>> score = sum(scores)
> Bools are also usefully used as sequence indexes.
Arguably, these sorts of uses only require bool to be /convertible/ to
int, not to necessarily be a /subclass/ of int.
More information about the Python-list