Conditional operator in Python?
Russell E. Owen
owen at astrono.junkwashington.emu
Mon Apr 2 13:41:00 EDT 2001
In article <3AC6BB2E.1E09B5AA at alcyone.com>,
Erik Max Francis <max at alcyone.com> wrote:
>...
>On a vaguely related subject, why is there no Boolean type in Python?
>Seems like it would clean things up a great deal -- my understanding is
>that there is even an internal Python Boolean type, but it is hidden in
>the interpreter. How come?
I suspect the basic reason is because C doesn't have one. But that's
just a guess.
I personally dislike the concept that "every variable has a boolean
value", and the associated fact that utterly different values have the
same logical value. But hey, a large numer of languages work this way
and it doesn't seem to cause too much trouble. (Though I think Python
would benefit from a built in function that tests for logical equality
-- if I'm missing one, please enlighten me; the best I've come up with
so far is: not a == not b, which is not exactly obvious.)
But even if the Python development team suddenly became convinced that a
separate boolean type was the way to go, it'd be quite a challenge to
implement such a thing without breaking a vast amount of existing code.
-- Russell
More information about the Python-list
mailing list