Question from the Python test

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

Medium

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: PublishedQuestion passed 8 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!