How to use the evaluate the code object returned by PyParser_Simp leParseString function?

Borse, Ganesh ganesh.borse at credit-suisse.com
Wed Nov 14 10:48:41 CET 2007


Hi,

Can someone please help me in the following question?
On the web page http://olympus.het.brown.edu/cgi-bin/info2www?(python2.3-api)Very+High+Level+Layer, I got the following information:

`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.

So, which function should be used for evaluating the parsed code generated by PyParser_SimpleParseString?
Do I need to use the "struct _node*" returned by PyParser_SimpleParseString?

Any example of this use would be more helpful?

Thanks in advance for guidance & help.

Warm Regards,
Ganesh

==============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================




More information about the Python-list mailing list