Eli Bendersky's website » Python metaclasses by example - 12 views
-
-
Mauro De Giorgi on 02 Jul 13Start read from here
-
-
Study and understand this example and you’ll grasp most of what one needs to know about writing metaclasses.
-
To control the creation and initialization of the class in the metaclass, you can implement the metaclass’s __new__ method and/or __init__ constructor [6]. Most real-life metaclasses will probably override just one of them. __new__ should be implemented when you want to control the creation of a new object (class in our case), and __init__ should be implemented when you want to control the initialization of the new object after it has been created.
- ...3 more annotations...