Edit Python code programmatically

greg greg at cosc.canterbury.ac.nz
Mon Feb 11 00:15:13 EST 2008


Guilherme Polo wrote:

> Generating code like this is always dangerous.

Generating code isn't dangerous in itself. What's dangerous
is mixing hand-edited and generated code in the same file.
There's too much opportunity for hand edits to get wiped
out by subsequent automatic edits or vice versa.

If you really want to generate code, find a way of
separating out the generated code into another .py
file that never needs to be edited by hand.

-- 
Greg



More information about the Python-list mailing list