What's the standard way to turn a code object into a function ?

Steven D. Majewski sdm7g at Virginia.EDU
Thu Aug 2 15:57:14 EDT 2001


I don't know if there is a "standard" way -- it's not something that
is routinely done. But take a look at the 'new' module.

>>> import new
>>> dir(new)
['__doc__', '__file__', '__name__', 'classobj', 'code', 'function',
'instance', 'instancemethod', 'module']
>>> new.function.__doc__
'Create a function object from (CODE, GLOBALS, [NAME [, ARGDEFS]]).'

See the library reference manual for a more complete description. 

-- Steve Majewski






More information about the Python-list mailing list