Home >Backend Development >Python Tutorial >python original class
What is the use of metaclass?
Good question, metaclass will be called when creating a new class that uses it, here are some views on the benefits of doing so:
◆ Decorate class All methods for logging or profiling.
◆ New method for automatic Mix-in
◆ Register classes on creation. (For example, automatically register plug-ins or create database schemas from class members.)
◆ Provide interface registration, automatic function discovery and interface adaptation.
◆ Class verification: Prevent subclassing and verify whether all methods have docstrings.