[Python-Dev] Re: PEP 285: Adding a bool type
Steve Holden
sholden at holdenweb.com
Sat Apr 6 10:02:51 EST 2002
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:mailman.1017853522.14491.python-list at python.org...
> andrew wrote:
> >
> > Fredrik> if you study real python code, you'll find that there is.
> >
> > I mean that the language doesn't prefer a single way,
> > as opposed to programmers' conventions.
>
> it's more than just a convention -- built-in functions and operators
> always return 0 for false and 1 for true whenever they need to in-
> vent a boolean value. this is documented in the language reference.
>
> (and if you look inside, there's something called Py_False that's an
> integer zero, and something called Py_True that is an integer one).
>
Which the Win32 extensions, for example, actually wrap up in an entirely
separate COM type, so that they don't compare equal to integer values.
> this is also true for the standard library, and lots of major extensions.
>
> also note that the PEP says "The bool type would be a straightforward
> subtype (in C) of the int type, and the values False and True would
> behave like 0 and 1 in most respects". Guido didn't pick those values
> out of thin air...
>
Since the decision not to move forward with Python 3000 it appear my
favorite language is dying the death of 1,000 cuts!
regards
Steve
More information about the Python-list
mailing list