Chapter 8. Metaprogramming, protocols, and more

This chapter covers

  • Python protocols

  • Dynamic attribute access

  • Metaprogramming with metaclasses

  • Advanced .NET interoperation

In this chapter, we’re going to look under the hood of the Python programming language. We’ve covered all the basic syntax and how to use classes from the .NET framework with IronPython. To make full use of Python, you need to know how to hook Python classes into the infrastructure that the language provides. As you write classes and libraries in Python, you’ll need to define how your objects take part in normal operations and interact with other objects. Much of this interaction is done through protocols, the magic methods that we’ve already briefly discussed.

We focus here on the ...

Get IronPython in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.