ACCEPTED: PEP 285
James Logajan
JamesL at Lugoj.com
Thu Apr 4 02:25:22 EST 2002
Guido van Rossum <guido at python.org> wrote:
[ ... ]
> 7) Should the name 'bool' be changed?
>
> => No.
Too bad. I believe his name was spelled Boole, not Bool or Boolean. You had
a chance to properly honor him and didn't for some reason. Why drop a
single letter of a dead man's name? This seems to be a pettiness that has
gained universal appeal, alas. Shades of "creat" versus "create". Maybe
there is some conspiracy against the letter "e" on the end of words?
[ ... ]
> Compatibility
>
> Because of backwards compatibility, the bool type lacks many
> properties that some would like to see. For example, arithmetic
> operations with one or two bool arguments is allowed, treating
> False as 0 and True as 1. Also, a bool may be used as a sequence
> index.
Just to be clear, what kind of object will this be when it is a key in a
dictionary? If I have:
x = { 1: "I win", 0: "I lose" }
and do
x[2 == 1] = "Bummer"
what does the dictionary contain? Two entries or three? Is a bool value
promoted to an int when used as a dictionary key?
More information about the Python-list
mailing list