Neil G Neil G - 4 months ago 12
Python Question

Determine a class's metaclass in Python 3

In Python 2, I could check a class's

__metaclass__
attribute to determine its metaclass.

How do I the same thing in Python 3?

Answer

Use the single-argument type function (type(class)), or just access class.__class__. Both of these work in Python 2, btw.

Comments