Python Metaprogramming
Learning Path ⋅ Skills: Python, Metaclasses, Descriptors, Dynamic Code Execution, exec(), eval(), Code Evaluation, Python Internals
Elevate your Python skills by mastering metaprogramming. Explore metaclasses, descriptors, and dynamic code execution using exec()
and eval()
. Ideal for advanced users wanting to harness Python’s dynamic capabilities.
Python Metaprogramming
Learning Path ⋅ 4 Resources
Course
Metaclasses in Python
Metaclasses are an important but mysterious behind-the-scenes mechanism for instantiating classes in Python. In this video course, you'll learn how Python's metaclasses work in object-oriented programming.
Tutorial
Python Descriptors: An Introduction
Learn what Python descriptors are and how they're used in Python's internals. You'll learn about the descriptor protocol and how the lookup chain works when you access an attribute. You'll also see a few practical examples where Python descriptors can come in handy.
Tutorial
Python's exec(): Execute Dynamically Generated Code
Learn how to use Python's built-in exec() function to execute code that comes as either a string or a compiled code object.
Course
Evaluate Expressions Dynamically With Python eval()
Learn how Python's eval() works and how to use it effectively in your programs. Additionally, you'll learn how to minimize the security risks associated to the use of eval().
Got feedback on this learning path?
Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!