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

Kevin Jacobs jacobs@penguin.theopalgroup.com
Wed, 3 Apr 2002 11:31:03 -0500 (EST)

On Wed, 3 Apr 2002, Fredrik Lundh wrote:
> Andrew Koenig 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.
> if you study real python code, you'll find that there is.

Having managed 200k+ LOC Python projects with at times 20+ developers, I
find that there isn't.  At least not without getting out a baseball bat.

The first thing many of our programmers want to do at the top of their
modules is to define:

False = 0
True = not False


false = 0
true = 1


TRUE = 1


from my_local_trashcan_module import true, false

  or some fairly extreme object implementations in Python or C.

Of course, I have to break their fingers and force them to stop re-inventing
their own true and false literals, and to use 1's and 0's like the rest of
the disadvantaged Python world.  Ah, the joys of code review.... Believe it
or not, this, naming conventions, and consistent exception handling styles
are among the biggest bones of contention we have during our code review

The moral of the story is that I will be extremely happy once there is a
globally blessed way of spelling true and false other than 1 and 0.  Of
course, I and my team aren't exactly typical Python developers.  Though
wouldn't it be nice if we were?


Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com