Code objects

Evan Klitzke evan at yelp.com
Tue Jul 24 02:55:12 EDT 2007


I was playing around with the inspect module tonight, and I have a
question about "code components". Can an object have more than one
code component? For example, will the following code ever create a
list whose length is greater than one?

import inspect

# Some code here defining an object/function foo

components = [cc[1] for cc in inspect.getmembers(foo,\
    inspect.iscode)]

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list