PEP 285: Adding a bool type

Roy Smith roy at panix.com
Sat Apr 6 15:27:34 EST 2002


Paul Sidorsky <paulsid at shaw.ca> wrote:
> The proper course of action here would be to add a second check,
> isPaid(), to wherever the new information is needed.

Or, instead of isValid() and isPaid(), have a single method, getStatus(), 
which could return invalidAccount, paymentOverdue, or accountUpToDate.  Not 
all things fit into a boolean, but those that don't shouldn't be accessed 
by methods whose names begin with "is".  I guess the die-hard lispers would 
say the same about names ending in "p" :-)

The most fascinating (and often, frustrating) example I know of "almost 
boolean" is SQL's concept of NULL.  In what other language can "A == B" and 
"A != B" both be false?  The problem is that they tried to cram two 
distinct concepts ("are the operands valid?" and "are the operands equal?") 
into a single conceptual slot.



More information about the Python-list mailing list