Distinction between “class” and “type”

Paul Rubin no.email at nospam.invalid
Fri May 13 19:06:35 EDT 2016


Terry Reedy <tjreedy at udel.edu> writes:
> I suspect that one could produce a class that is not a type, in
> Guido's meaning, with a metaclass that is not a subclass of the type
> class.  I don't otherwise know what Guido might have meant.

I think meant that if X is a class, then X is (usually) also a type; but
the reverse is not true.  We used to think of type and class as the same
thing in practice.  We didn't have to concern ourselves about too much
about theoretical or pedantic differences that might exist.

Now with PEP 484, the situation where X is a type but not a class is
significant enough in practice that we have to be more careful about the
distinction than we were in the Python 2 era.

There may(?) also be situations where X is a class but not a type, but I
don't think that's being considered as important as the other direction.



More information about the Python-list mailing list