On 22/12/2020 00:52, Christopher Barker wrote:
On Mon, Dec 21, 2020 at 3:37 PM Greg Ewing
<[email protected] <mailto:[email protected]>> wrote:
> However, that ship has sailed. I think it would have been minimally
> disruptive when True and False were first introduced,
It would have been just as disruptive back then -- that's the
reason bool was made a subclass of int in the first place.
I know why, but I'm not so sure -- no one was using a built in True or
False as an integer, because they didn't exist. I suppose folks were
using the results of, e.g. `a == b` as an integer, but how often?
Where else is an explicit True or False returned by Python itself?
The `bool` function, of course, `in`, `is` and `isinstance`,
`str.isdigit`, ..., |`threading.||Lock.acquire|`. Quite a few if you
search for "return PyBool_".
Except for counting (with `sum`), I don't think you would use any of
those arithmetically. But there's this kind of thing:
>>> [f"{n+1} {g}{(n>0)*'s'}" for n, g in enumerate(gifts)][::-1]
['4 calling birds', '3 french hens', '2 turtle doves', '1 partridge in a
pear tree']
Go on, you know you want to.
Jeff
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/Y64AGTVPTKD5VKWUZCKUZU6TOUREAQIV/
Code of Conduct: http://python.org/psf/codeofconduct/