On Tue, Dec 22, 2020 at 11:52 AM Christopher Barker firstname.lastname@example.org wrote:
On Mon, Dec 21, 2020 at 3:37 PM Greg Ewing email@example.com 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.
No, but AIUI people were creating their own globals to do that job. And in Python 2, True and False weren't keywords, just built-ins, so you could keep on writing "True = 1" and everything would be fine.
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?
Actually, I do that sort of thing periodically. Or rather, I use it as an index, which comes to the same thing. Every language I've used since leaving BASIC behind has allowed me to use a comparison as if it were a 1 or a 0. (Many of them because 1 and 0 *are* the values for true and false.) Well, every language except one, and even that one has some oddities that make the values mostly equivalent.