eval or execute, is this the (most) correct way ?
"Martin v. Löwis"
martin at v.loewis.de
Mon Aug 11 17:23:04 EDT 2008
> So AFAIK, sometimes I've to use eval and sometimes I need exec,
> so I use the following code (global / local dictionary parameters are
> left out in this example):
>
>
> Is this the (most) correct / elegant way, or are there better solutions ?
You should be using compile with the "single" start symbol, and then
use eval on the resulting code option.
> I read somewhere that exec is going to disappear,
That's not true. exec stops being a statement, and becomes a function
(like print).
Regards,
Martin
More information about the Python-list
mailing list