tjreedy at udel.edu
Tue Jul 24 17:34:03 CEST 2007
"Evan Klitzke" <evan at yelp.com> wrote in message
news:cfb58d850707232355p5a1c7214l1486c2276389b25b at mail.gmail.com...
|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?
As produced by CPython, a function object has one code attribute,
.func_code I think. On the other hand, you should be able to attach other
code objects under different names, such as .func_code2. Such would,
however, be ignored in function calls.
| 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 for cc in inspect.getmembers(foo,\
Try it on such an augmented function object.
More information about the Python-list