Class Metaprogramming

Class metaprogramming is the art of creating or customizing classes at runtime. Classes are first-class objects in Python, so a function can be used to create a new class at any time, without using the class keyword.  Class decorators are also functions, but capeble of of inspecting, changing, and even replacing the decorated class with another class.  Finally, metclasses are the most advanced tool for class metaprogramming: they let you create whole new categories of classes with special traits, such as the abstract base classes.

end ...

原文地址:https://www.cnblogs.com/neozheng/p/12640104.html