[Python-Dev] Re: PEP 285: Adding a bool type
03 Apr 2002 12:36:14 -0500
>> I mean that the language doesn't prefer a single way,
>> as opposed to programmers' conventions.
Fredrik> it's more than just a convention -- built-in functions and
Fredrik> operators always return 0 for false and 1 for true whenever
Fredrik> they need to invent a boolean value. this is documented in
Fredrik> the language reference.
On the other hand, the library isn't nearly so consistent. Just for
fun, I started browsing the library documentation at random.
The very first page I visited was the description of gc, the
garbage collector interface. The first function that returns
a truth value there is described as
Returns true if automatic collection is enabled.
Some more examples:
220.127.116.11 String Methods
Return true if the string ends with the specified suffix,
otherwise return false.
Similarly for isalnum, isalpha, isdigit, islower, isspace.
2.2.8 File Objects:
Return true if the file is connected to a tty(-like) device,
6.2 os.path -- Common pathname manipulations
Return true if path refers to an existing path.
I'm sure there are others.
Andrew Koenig, email@example.com, http://www.research.att.com/info/ark