4 ms·
Its not weak typeing, bools are ints. “I don’t know the type hierarchy used in language X” is not the same thing as “language X is weakly typed”. Python 3.1
by dragonwriter 3y ago
Its not weak typeing, bools are ints.
“I don’t know the type hierarchy used in language X” is not the same thing as “language X is weakly typed”.
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> isinstance(True, int)
True
>>> isinstance(False, int)
True
>>> issubclass(bool, int)
True
- pxeger1 3y agoBools are ints, but I'd say that makes Python weakly typed (ish - it's a spectrum obviously). Are you just using "weak typing" to mean "implicit type coercion"?