Re: isinstance(False, int)

2010-03-08 Thread Bruno Desthuilliers
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

Re: isinstance(False, int)

2010-03-05 Thread Robert Kern
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

Re: isinstance(False, int)

2010-03-05 Thread Chris Rebert
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

Re: isinstance(False, int)

2010-03-05 Thread Jack Diederich
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

Re: isinstance(False, int)

2010-03-05 Thread Steven D'Aprano
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

Re: isinstance(False, int)

2010-03-05 Thread Robert Kern
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

Re: isinstance(False, int)

2010-03-05 Thread Terry Reedy
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

Re: isinstance(False, int)

2010-03-05 Thread Terry Reedy
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

Re: isinstance(False, int)

2010-03-05 Thread Jack Diederich
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

Re: isinstance(False, int)

2010-03-05 Thread Steven D'Aprano
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

Re: isinstance(False, int)

2010-03-05 Thread mk
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

Re: isinstance(False, int)

2010-03-05 Thread Rolando Espinoza La Fuente
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

Re: isinstance(False, int)

2010-03-05 Thread Jean-Michel Pichavant
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.

Re: isinstance(False, int)

2010-03-05 Thread mk
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

Re: isinstance(False, int)

2010-03-05 Thread MRAB
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

Re: isinstance(False, int)

2010-03-05 Thread Rolando Espinoza La Fuente
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

Re: isinstance(False, int)

2010-03-05 Thread Steven D'Aprano
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 > >

Re: isinstance(False, int)

2010-03-05 Thread Stephen Hansen
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

Re: isinstance(False, int)

2010-03-05 Thread Arnaud Delobelle
mk writes: >>>> isinstance(False, int) > True >>>> >>>> isinstance(True, int) > True > > Huh? > >>>> >>>> issubclass(bool, int) > True > > Huh?! > > Regards, > mk Yes, and: >>> True + Fa

Re: isinstance(False, int)

2010-03-05 Thread Steve Holden
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)

2010-03-05 Thread mk
>>> isinstance(False, int) True >>> >>> isinstance(True, int) True Huh? >>> >>> issubclass(bool, int) True Huh?! Regards, mk -- http://mail.python.org/mailman/listinfo/python-list