class PersonMeta type def __new__ cls name bases dict cache init_cache

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class PersonMeta(type):
def __new__(cls, name, bases, dict):
cache = init_cache()
dict['cache'] = cache
return super(PersonMeta, cls).__new__(name, bases, dict)
Traceback (most recent call last):
....
return super(PersonMeta, cls).__new__(name, bases, dict)
TypeError: Error when calling the metaclass bases
type.__new__(X): X is not a type object (str)
---------------------
return type.__new__(cls, name, bases, dict) работает, разумеется