A gotcha: Python pain point?

2007-06-11 Thread Beorn
Consider this example: >>> def funcs(x): ... for i in range(5): ... def g(): return x + i ... yield g I would expect the value of x used in g to be that at the function declaration time, as if you've pass g a (x=x) argument, especially after reading this post: http://l

Re: A gotcha: Python pain point?

2007-06-12 Thread Beorn
On Jun 12, 5:00 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Beorn wrote: [...] > > I can see how it works now, but I haven't found an easy-to-read > > documentation on this. > > This has been discussed here very often. Python closures do capture

Re: The Future of Python Threading

2007-08-10 Thread Beorn
Btw, although overly simple (single CPU system!), this benchmark is pretty interesting: http://muharem.wordpress.com/2007/07/31/erlang-vs-stackless-python-a-first-benchmark/ About the GIL: I think I've heard Guido say the last attempt at removing the Global Interpreter Lock (GIL) resulted in