Robert Kern <robert.k...@gmail.com> wrote: > On 2009-02-26 15:29, m...@pixar.com wrote: > Use the compiler module to generate an AST and walk it. That's the real > way. For me, that would also be the quick way because I am familiar with > the API, but it may take you a little bit of time to get used to it.
ah, that's just what I was hoping for... in the meantime, here's my quick and dirty: import csv def fakeparse(s): print "=======" argl=[] ix=s.find('(') if ix == -1: func=s argl=[] else: func=s[0:ix] argstr=s[ix+1:] argstr=argstr[:argstr.rfind(')')] print argstr for argl in csv.reader([argstr], quotechar="'"): pass print s print func print argl return func,argl print fakeparse("junkpkg.f1") print fakeparse("junkpkg.f1()") print fakeparse("junkpkg.f1('aaa')") print fakeparse("junkpkg.f1('aaa','bbb')") print fakeparse("junkpkg.f1('aaa','bbb','ccc')") print fakeparse("junkpkg.f1('aaa','xx,yy')") -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-list