How to define what a class is ?

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Feb 24 15:44:33 EST 2016


Ian Kelly wrote:

> All metaclasses are subclasses of type, so all classes are instances of type.

I think that's about the most general definition you
can find. Almost everything else that you might think
of as being part of the classness of a class can be
overridden.

Another definition might be that it's something that
is potentially the result of type(x) for some x.
I think that's equivalent, because at the C level
type(x) returns the value of x->ob_type, which
always points to an instance of type or a subclass
thereof.

-- 
Greg



More information about the Python-list mailing list