"Evan Klitzke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |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[1] for cc in inspect.getmembers(foo,\ | inspect.iscode)] Try it on such an augmented function object. tjr -- http://mail.python.org/mailman/listinfo/python-list