13.12. Type vs. Classes/Instances

Unlike languages such as Java, Python standard types are not classes and variables are not instances of such classes. Rather, they are simply primitive types that do not allow for direct derivation. (As it turns out, a class is simply a specific type of primitive built-in that does allow for derivation.)

Python supports a fixed number of built-in types; thus, even instances themselves are of a singular type (“instance”), and classes are all of type “class.” (Also review the Core Note earlier in this chapter which posed the issue of why instances are all of the same type.)

Subclassing of standard types is not possible, though often desired. Python provides for some elegant solutions, one of which is to create ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.