“This article is the second in a two-part series that digs deep
to explore the fascinating new-style Python object model, which was
introduced in Python 2.2 and improved in 2.3 and 2.4. The object
model and type system are very dynamic and allow quite a few
interesting tricks. In part one I described the object model and
type system, explored various entities, explained the life cycle of
an object, and introduced some of the countless ways to modify and
customize almost everything you thought immutable at runtime. In
this article I will contrast meta-classes with decorators, explore
the Python execution model and explain how to examine stack frames
at runtime. Finally, I will demonstrate how to augment the Python
language itself using these techniques. To do this I introduce a
private access-checking feature that can be enforced at
runtime…”