PEP 285: Adding a bool type
Martin v. Loewis
martin at v.loewis.de
Sun Mar 31 17:18:37 EST 2002
Pearu Peterson <pearu at cens.ioc.ee> writes:
> Just a random thought ...
>
> Theorem:
> ========
> Assume specification of PEP 285. The following statements hold truth:
>
> True is One
>
> and
>
> False is Zero,
>
> where One and Zero represent integers 1 and 0, respectively.
It depends on what the meaning of 'is' is. Did you mean 'is' in the
Python sense of checking identity? Then this theorem can't possibly
true: type(One) is int and type(True) is bool implies One is not True.
>
> Proof:
> ------
> According to PEP, True and False are instances of bool that is a subclass
> of int. Therefore True and False can be considered as integers and it
> makes sense to compare them with integers. If n is an integer then the
> following statements hold
>
> True == n only if n is 1
>
> and
>
> False == n only if n is 0.
That is correct. However, a==b does not imply a is b.
Regards,
Martin
More information about the Python-list
mailing list