replacement of rexec?
Skip Montanaro
skip at pobox.com
Thu Oct 30 10:23:30 EST 2003
>> You could use the new compiler module to parse and inspect the result
>> like this:
>>
>> import compiler as cplr
>> mod = cplr.parseFile("filetoload")
>> for node in mod.node.nodes:
>> if 'Function' in str(node):
>> break
Huaiyu> Thanks for the suggestion. Is there existing code to assemble
Huaiyu> the parsed tree back to the intended Python object? It's
Huaiyu> probably not too hard to write one, but I wonder if this is
Huaiyu> already done?
I'm not aware of anything. Assuming your inspection process shows the file
is okay, why not just call execfile()?
Skip
More information about the Python-list
mailing list