Hello all, I'm trying to extract the code object from a function, and exec it without explicitly passing parameters.
The code object 'knows' it expects to receive paramaters. It's 'arg_count' attribute is readonly. How can I set the arg_count to 0, or pass parameters to the code object when I exec it ? >>> def f(x): ... print x ... >>> c = f.func_code >>> type(c) <type 'code'> >>> exec c Traceback (most recent call last): File "<input>", line 1, in ? TypeError: f() takes exactly 1 argument (0 given) >>> c.co_argcount 1 >>> c.co_argcount = 0 Traceback (most recent call last): File "<input>", line 1, in ? TypeError: readonly attribute >>> Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list