Introduction to Meta-Programming
Learn about meta-programming and type() function in this lesson.
We'll cover the following
What is meta-programming?
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 for classes by introducing meta-classes.
Type of an object
In Python, everything has a type. You can check the type by using the built-in function type()
. When we create an integer variable, we are creating an object of int
class. The same goes for any custom class:
Get hands-on with 1400+ tech skills courses.