exec statement with/without prior compile...

Arnaud Delobelle arnodel at googlemail.com
Tue May 26 10:46:04 CEST 2009


"Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> writes:

> En Mon, 25 May 2009 11:07:13 -0300, Jaime Fernandez del Rio
> <jaime.frio at gmail.com> escribió:
>> And since I'm asking, could something similar, i.e. defining a new
>> function and get a handle to it, be achieved with eval?
>
> No, because def is a statement, and eval only accepts an expression.

Well there is the lambda expression, which would work in the example
given in the OP.

-- 
Arnaud



More information about the Python-list mailing list