I would like to create a new type using type(...). How do I provide the Meta class for this type?
1 Answer
You don't provide it to type as an argument, the metaclass would subclass type itself, so you would call the metaclass' constructor instead.
2 Comments
Krystian Cybulski
I am not sure I understand. Could you provide a code example for assigning a Meta with
abstract = True or a link which explains this?Silas Ray
Are you talking about Django here? Those aren't true metaclasses. If what you want is a Django-style Meta class on a model, just create a class object with whatever class attributes you need, then add that class to the attributes dictionary you pass to
type with the key Meta.