Cleaner Code Using Function Pointers in Python

Now that I have you hooked on the title, Python doesn’t have function pointers. Instead everything is treated as an object in Python which means functions are objects. The snippet below shows this:

>>> def my_func():
... pass
>>> isinstance(my_func, object)

However since we can set functions in Python to a variable and reference it, you’ll see it commonly referred to as a function pointer.