Elektrine lite

← Feed

@catgirl_so@tech.lgbt

Post #2975022

2025-11-12 10:12 UTC

@orman@furry.engineer @apmasell@mastodon.social @Gankra@toot.cat issubclass(bool, int) has been true for the entire time that bool has been a class; in fact, isinstance(True, int) and isinstance(False, int) has been true (or rather, 1) since before bool even existed! in python 2.0 and 2.0.1, there was no bool in the global namespace, and True and False were just the ints 0 and 1 respectively. python 2.1 introduced bool as this function (defined in Lib/symtable.py): def bool(x): """Helper to force boolean result to 1 or 0""" if x: return 1 return 0 only in python 2.3 did bool become its own class (defined in Objects/boolobject.c), and from that point onward bool has always subclassed int. type checkers treating bool as a subtype of int just reflects how python has worked since long before the type checkers existed. (source: poking around source tarballs downloaded from https://www.python.org/ftp/python/)

Replies (0)

No replies.