Re: exec "def.." in globals(), locals() does not work

2007-02-19 Thread xml0x1a
On Feb 19, 8:15 pm, "George Sakkis" <[EMAIL PROTECTED]> wrote: > On Feb 19, 10:52 pm, [EMAIL PROTECTED] wrote: > > > How do I use exec? > > Before you ask this question, the one you should have an answer for is > "why do I (think I) have to use exec ?". At least for the example you > gave, you don'

exec "def.." in globals(), locals() does not work

2007-02-19 Thread xml0x1a
How do I use exec? >python -V Python 2.4.3 from math import * G = 1 def d(): L = 1 exec "def f(x): return L + log(G) " in globals(), locals() f(1) How do I use exec() such that: 1. A function defined in exec is available to the local scope (after exec returns) 2. The defined funct