Re: exec'ing functions

2004-12-10 Thread Mel Wilson
In article <[EMAIL PROTECTED]>, Peter Otten <[EMAIL PROTECTED]> wrote: >Mel Wilson wrote: >> The thing is, that once you drop local-namespace >> optimization, the entire function gets slowed down, possibly >> by 40%: >It's not that bad as most of the extra time is spend on compiling the >string. [

Re: exec'ing functions

2004-12-10 Thread Peter Otten
Mel Wilson wrote: > The thing is, that once you drop local-namespace > optimization, the entire function gets slowed down, possibly > by 40%: It's not that bad as most of the extra time is spend on compiling the string. def fib5(n): a, b, i = 0, 1, n while i > 0: a, b = b, a+b

Re: exec'ing functions

2004-12-09 Thread Mel Wilson
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: >Jeff Shannon wrote: >> I was referring to functions which have an internal exec statement, not >> functions which are created entirely within an exec -- i.e., something >> like this: > >Thanks for the clarification. Here's

Re: exec'ing functions (WAS: updating locals() and globals())

2004-12-08 Thread Steven Bethard
Jeff Shannon wrote: Steven Bethard wrote: Jeff Shannon wrote: Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions In what circumstances will this be true? I couldn't verify it: [snip] I was referring to fu

Re: exec'ing functions (WAS: updating locals() and globals())

2004-12-08 Thread Jeff Shannon
Steven Bethard wrote: Jeff Shannon wrote: Note also that functions which use exec cannot use the static namespace optimization, and thus tend to be *much* slower than normal functions In what circumstances will this be true? I couldn't verify it: [...] exec """\ def fib2(n): a, b = 0, 1