monkey patching __code__

Terry Reedy tjreedy at udel.edu
Fri Mar 18 12:48:32 EDT 2016


On 3/18/2016 10:32 AM, Sven R. Kunze wrote:

> Just to understand this better: why is [function.__defaults__]
 > not part of the code object but part of the function?

compile(codestring, ...) compiles code into a code object.  Besides 
being used to compile function bodies, which do have a function header, 
it is also used to compile code without a function header: imported 
modules, class bodies, code passed to exec() and eval(), and code passed 
to compile() itself.

-- 
Terry Jan Reedy




More information about the Python-list mailing list