How does python prevent a class from being subclassed? [duplicate]
问题 This question already has an answer here: Final classes in Python 3.x- something Guido isn't telling me? 4 answers I came across the following in the python docs: bool([x]) Convert a value to a Boolean, using the standard truth testing procedure. If x is false or omitted, this returns False; otherwise it returns True. bool is also a class, which is a subclass of int. Class bool cannot be subclassed further. Its only instances are False and True. I've never in my life wanted to subclass bool ,