Booleans and comparison results
Gerrit Holl
gerrit at nl.linux.org
Tue Jun 24 11:27:09 EDT 2003
Roman Suzi wrote:
> Just a thought. Why cmp() returns -1,0,1 while comparison
> results are False and True? Isn't it logical step to add
> Less, Equal and More?
>
> >>> cmp(1,2)
> Less
> >>> cmp(1,-1)
> More
> >>> cmp(1,1)
> Equal
Well, "Less" is not always the right term:
cmp("", " ")
Is "" less than " "? I don't think so: I think that for non-numbers, "Less"
and "More" may be misleading/incorrect. I like the idea though ;)
> rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
17:26:55:2:gerrit at stopcontact:~$ cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)
Gerrit.
--
7. If any one buy from the son or the slave of another man, without
witnesses or a contract, silver or gold, a male or female slave, an ox or
a sheep, an ass or anything, or if he take it in charge, he is considered
a thief and shall be put to death.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/
More information about the Python-list
mailing list