An idiom for code generation with exec

Peter Otten __peter__ at
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()


More information about the Python-list mailing list