Hacker News new | ask | show | jobs
by dragonwriter 1034 days 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
1 comments

Bools 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"?