A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029661.html below:

[Python-Dev] PyEval_EvalCode()

[Python-Dev] PyEval_EvalCode()Tino Lange Tino.Lange@isg.de
Thu, 17 Oct 2002 19:09:08 +0200
Guido van Rossum wrote:

Hi!

Thanks for your reply!

> > PyEval_EvalCode()
> > This prototype is not available when including "Python.h" (Using v2.1.3)
> > Why did you exclude it from the "official" API prototypes? 
> Because it's unlikely that someone writing a Python extension would
> ever have a need for it.

Sure?
I'd like to use it in a program that embeds a Python interpreter.
The code snippets get compiled and checked by that function and can be
called as a code object afterwards.
 
> > Isn't that PyEval_EvalCode() the regular API function to run
> > CodeObjects from Py_CompileString() ? 
> Probably -- I've never used it this way.

At least a solution like that is described in the lastest "Programming
Python" bible by Mark Lutz.
(covering Python 2)

> But why aren't you using
> PyRun_String()?

Speed, efficiency.
If the code get's executed quite often (i. e. multiple times a second)
it's worth precompiling (and maybe optimizing by Py_OptimizeFlag = 1),
or? PyRun_String() will compile and check _every_ time - wasting a lot
of resources.

Cheers

Tino



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4