comparing booleans
Gerrit Holl
gerrit at nl.linux.org
Wed Jan 28 16:21:46 EST 2004
Hi,
is it proper to compare booleans? It is possible, of course, because
they're compatible with numbers, but booleans aren't truly numbers. I'm
tempted to write:
return cmp(self.extends, other.extends)
instead of
if self.extends and not other.extends:
return 1
else:
return -1
# I've already verified self.extends != other.extends
...but somehow comparing Booleans doesn't feel right...
Is my feeling correct?
(Hmm, makes me wonder, for booleans, are != and ^ equal?)
Gerrit.
--
174. If she bear no sons to her second husband, the sons of her first
husband shall have the dowry.
-- 1780 BC, Hammurabi, Code of Law
--
PrePEP: Builtin path type
http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/
More information about the Python-list
mailing list