Chapter 6: Implementing Reflection on Python Objects
In this chapter, we will look at reflection in Python 3 and understand how it is useful in metaprogramming. Reflection is a continuation of introspection, or it can be looked upon as a concept where we can make use of the information we learn from the introspection of properties or attributes of objects in Python and apply them to manipulate the objects, and so perform metaprogramming.
Why reflection? As we know from the previous chapter, introspection is an information-gathering process for Python objects. Reflection is the process of utilizing the information gathered from objects through introspection, and in turn, performing generic operations on them by manipulating them externally to perform metaprogramming.
Throughout this chapter, we will look at implementing reflection using each function that helped us introspect objects in the previous chapter and perform metaprogramming on the objects we use in our programs.
...