An idiom for code generation with exec

Peter Otten __peter__ at web.de
Fri Jun 20 14:44:46 CEST 2008


eliben wrote:

> Additionally, I've found indentation to be a problem in such
> constructs. Is there a workable way to indent the code at the level of
> build_func, and not on column 0 ?

exec "if 1:" + code.rstrip()

Peter




More information about the Python-list mailing list