En Wed, 14 Nov 2007 06:48:41 -0300, Borse, Ganesh <[EMAIL PROTECTED]> escribió:
> `struct _node* PyParser_SimpleParseString(char *str, int start)' > Parse Python source code from STR using the start token START. The > result can be used to create a code object which can be evaluated > efficiently. > This is useful if a code fragment must be evaluated many times. > > I have exactly same requirement. I have dynamic expressions loaded from > database at startup in my C++ application. > I want to parse these expressions at startup & keep the parsed > (compiled) code in memory of this application. > Then at runtime, I want to evaluate all this parsed code. This has to be > very efficient. parsed != compiled. Use Py_CompileString instead. The resulting code object may be executed with PyEval_EvalCode. BTW, instead of looking at some random web site, it's better to read the official documentation at http://docs.python.org. You should have a copy of it in the Doc subdirectory inside your Python installation. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list