ошибка метакласса: type.__init__() принимает 1 или 3 аргумента

I have a metaclass:

class MyMeta(type):
    def __init__(cls, name, bases, dct):
        # Do something
        ...

        return super(MyMeta, cls).__init__(cls, name, bases, dct)

and a class:

class MyClass(object):
    __metaclass__ = MyMeta

When I use these I get the following error:

TypeError: Error when calling the metaclass bases
    type.__init__() takes 1 or 3 arguments

What's the problem, and why does type.__init__() take a exactly variable number of arguments?

5
задан martineau 1 July 2018 в 18:45
поделиться