Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does a metaclass do?
Think about who creates classes.
What method do we override to define a custom metaclass?
This method is responsible for instance creation.
What is a metaclass?
Think about who oversees the blueprint for classes.
True or False: Every class in Python has a metaclass.
Consider the relationship between a class and its structure.
Write a custom metaclass that ensures any class it creates must have a __str__ method defined. Implement this metaclass and demonstrate its usage.
Think about where to insert the check for the __str__ method.
Develop a metaclass that adds a logger when a new class is created. Show the output of the logger when a class is defined.
Consider how to capture the creation event in the metaclass.
5 more questions in this section. Enroll free to practise them all.
Enroll free