Search⌘ K

What is meta-programming?

Explore the concept of meta-programming in Python by learning how code can manipulate itself using functions, decorators, and metaclasses. Understand how classes are instances of metaclasses and how metaclasses control class behaviors. This lesson helps you grasp dynamic class modifications and prepares you to use meta-programming for more flexible code design.

The potential of a code to be able to manipulate itself is called meta-programming. Sounds mystical, right?

In Pythonic terms, creating functions and classes to manipulate code by modifying the existing code, or generating code is meta-programming.

As far as meta-programming via functions is concerned, we had already covered it when we discussed decorators in the first half of the course. Python also supports meta-programming ...