Guilherme Polo wrote: > 2008/2/9, Arnaud Delobelle <[EMAIL PROTECTED]>: >> On Feb 9, 12:32 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: >> > 2008/2/9, Alex <[EMAIL PROTECTED]>: >> > >> > > Guilherme Polo wrote: >> > > > 2008/2/9, Alex <[EMAIL PROTECTED]>: >> >> > > >> Which library could you recommend to perform simple editing of >> Python >> > > >> code (from Python program)? For example, open *.py file, find >> specific >> > > >> function definition, add another function call inside, find >> existing >> > > >> call and change parameter value, etc. >> > > > You are after inspect, it is included with python. >> > >> > > Yes, I forgot to mention - I'm new to Python. I didn't necessary mention >> > > 3rd party library. Simply such wasn't mentioned in library review and >> > > tutorials, so I didn't know of it. What's the module's name? >> > >> >>> inspect is a module, inspect is the name. It is not a module for >> > editing Python code per se, but it will help with the other part. >> >> >> I don't think the OP wants to edit python code *objects*, rather he >> wants to edit python *source* code programmatically. Inspect is not >> the tool for this. > > I didn't tell him to use inspect to edit python code, I said it was > useful for the other part. The other part, as he mentioned on his > email is: "find specific > function definition, add another function call inside, find existing > call". > Yes, the OP was a little ambiguous. So I ought to mention [sigh, these name] bicycle repair man
http://bicyclerepair.sourceforge.net/ It provides refactoring functionality for Python, so may have some bits in it that will help (though I don't know how up to date it is). regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list