Adding metadata to built-in types in Python
In this article I will show how you add metadata to any object and optionally change only part of its behavior (in this example the string representation __str__), while maintaining all other data and behavior of the object itself.
I will show how to write a class that dynamically decides which base class to use, based on the parameters that are passed to the constructor. I call that “dynamic inheritance”.
This way you can build universal decorators. (Decorators that work on more than one type.)
More »




