An idiom for code generation with exec

eliben eliben at gmail.com
Fri Jun 20 15:41:08 EDT 2008


> [1] except using compile to build a code object with the function's
> body, then instanciate a function object using this code, but I'm not
> sure whether it will buy you much more performance-wise. I'd personnaly
> prefer this because I find it more explicit and readable, but YMMV.
>

How is compiling more readable than exec - doesn't it require an extra
step ? You generate code dynamically anyway.

Eli



More information about the Python-list mailing list