Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is a metaclass?
Think about the relationship between classes and objects.
How do you define a custom metaclass?
What base class do we use in Python for metaclasses?
What defines how classes behave in Python?
Think of what creates or modifies class structure.
True or False: Custom metaclasses can add methods to all instances of a class.
Consider the functionality provided by overriding `__new__`.
Create a metaclass that requires all classes defined with it to have a __str__ method. Write an example class using this metaclass.
What should you look for when defining the behavior in `__new__`?
Implement a metaclass that logs every time a class is created. Show how you would do this in practice.
What action occurs in `__new__` during class creation?
4 more questions in this section. Enroll free to practise them all.
Enroll free