Ian Kelly wrote:
Wait, are you actually asking why bool is a doubleton? If nobody has
answered that, I think probably nobody understood you were asking it,
because it shouldn't need to be explained.

What does perhaps need explaining is why Python goes
out of its way to *enforce* the doubleton-ness of bool.

I don't know all of Guido's reasoning on this, but part
of it is probably to do with implementation efficiencies.
There are several places in the CPython source where it's
assumed that, if an object is known to be of type bool,
then its truth or falseness can be determined with a
pointer comparison.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to