On Thu, Feb 9, 2012 at 10:33 AM, Denis Rouzaud <[email protected]> wrote:
> Hi all,
>
> I am dealing with the same problem for a while now, can someone tells me why
> these commands give a syntaxerror:
>
> eval("myvar ='3'")
There is a difference between evaluation (eval) and execution (exec)
of some code. When evaluating you only want a result of an expression.
When executing you actually run one or more statements in the current
context.
>>> eval("1+2")
3
>>> exec "x=1"
>>> x
1
Also note that exec is a statement (no parentheses) while eval is a
builtin function.
Martin
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer