vendredi 15 septembre 2017

How to test a function in python AST?

I have a text file with python function definitions like this:

def nsd(a, b):\n    if b == 0: return a    \n    return nsd(b, a%b)\n

and I would like to test them. I know how to parse it into an AST tree but how can I run the function with some test arguments? And how can I get the results? Is it even possible?

Aucun commentaire:

Enregistrer un commentaire