14.2. Code Objects

Callables are a crucial part of the Python execution environment, yet are only one element of a larger landscape. The grander picture consists of Python statements, assignments, expressions, even modules. These other “executable objects” do not have the ability to be invoked like callables. Rather, these objects are the smaller pieces of the puzzle which make up executable blocks of code called code objects.

At the heart of every callable is a code object which consists of statements, assignments, expressions, and other callables. Looking at a module means viewing one large code object which contains all the code found in the module, which can then be dissected into statements, assignments, expressions, and callables which ...

Get Core Python Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.