Stef Mientki wrote:
>>
>Which locals does this get you? __init__'s? (locals()?)
AFAIK locals() == sys._getframe(0 ).f_locals
Then it is not clear to me which locals your are getting.
>>
>Isn't this just the same as globals()?
AFAIK, again one level up
weird, I use it in 2.5 and if I remember well it already worked in 2.4.
but exchanging the function with the statement yields exactly the same
results
2.5 manual says
"6.14 The exec statement
exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]
This statement supports dynamic execution of Python code. The first
expression should evaluate to either a string, an open file object, or a
code object."
Your expression evaluates to a tuple (triple), which is not documented.
From the error message, I wondoer if p_globals, p_locals is ignored. Try
exec code in p_globals, p_locals
>> import sys
>> p_locals = sys._getframe(1 ).f_locals
>> p_locals = sys._getframe(1 ).f_locals
>Which locals does this get you? __init__'s? (locals()?)
>> p_globals = sys._getframe(1 ).f_globals
>Isn't this just the same as globals()?
>>
>>
>This is 3.0 exec function syntax.
>> try :
>> exec ( code, p_globals, p_locals )
>> exec ( code, p_globals, p_locals )
>This is 3.0 exec function syntax.
but exchanging the function with the statement yields exactly the same
results
"6.14 The exec statement
exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]
This statement supports dynamic execution of Python code. The first
expression should evaluate to either a string, an open file object, or a
code object."
Your expression evaluates to a tuple (triple), which is not documented.
From the error message, I wondoer if p_globals, p_locals is ignored. Try
exec code in p_globals, p_locals