Home >Backend Development >Python Tutorial >python original class

python original class

巴扎黑
巴扎黑Original
2016-12-07 11:21:351324browse

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.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn