Question from the Python test

What is the role of the Base metaclass in this Python code?

Waiting for validation

What is the role of the Base metaclass below?

class Base(type):
    def __new__(cls, name, bases, attrs):
        super_new = super().__new__
        attrs['custom_attribute'] = False
        return super_new(cls, name, bases, attrs)


class Middle(metaclass=Base):
    def __init__(self, firstname):
        self.firstname = firstname


class Bottom(Middle):
    pass
Author: John PendenqueStatus: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!