[Python-Dev] Re: PEP 285: Adding a bool type

Steve Holden sholden at holdenweb.com
Sat Apr 6 09:56:55 EST 2002


"Erik Max Francis" <max at alcyone.com> wrote in message
news:3CACA68C.C7B44901 at alcyone.com...
> phil hunt wrote:
>
> > On 03 Apr 2002 10:59:13 -0500, Andrew Koenig <ark at research.att.com>
> > wrote:
> >
> > >Specifically: If I want to write a function that answers a yes/no
> > >question, I have lots of possible ways of spelling yes (1, 2, "yes",
> > >and so on) and lots of possible ways of spelling no (0, {}, None,
> > >and so on).  There isn't a single preferred way.
> >
> > Yes there is, 1 or 0.
>
> No, there isn't.  Some return 0 or 1, some return 0 or an unspecified
> integer, some return None or an object, etc.
>
I think the post to whom you are responding would probably take the view
that the value returned by the comparison and logical operators (==, !=,
not, etc.) is preferred. For that purpose Python currently uses 1 or 0.

In other words, for all x, not not x is in [0, 1]

regards
 Steve







More information about the Python-list mailing list