IPython - Dynamic Object Introspection

IPython has different ways of obtaining information about Python objects dynamically. In this chapter, let us learn the ways of dynamic object introspection in IPython.

Use of ? and ?? provides specific and more detailed information about the object. In the first example discussed below, a simple integer object a is created. Its information can be procured by typing a ? in the input cell.

Dynamic Object Introspection in IPython

In the second example, let us define a function and introspect this function object with ? and ??.

Function and Introspect

Note that the magic function %psearch is equivalent to the use of ? or ?? for fetching object information.

Kickstart Your Career

Get certified by completing the course

Get Started