Re: GIL in alternative implementations

2011-06-07 Thread Ian Kelly
On Tue, Jun 7, 2011 at 2:22 PM, Ian Kelly wrote: > from functools import partial > > def g(value): >    print(value) >    return partial(g, value+1) > > f = partial(0) > for i in range(1): >    f = f() The "partial(0)" should read "partial(g, 0)", of course. -- http://mail.python.org/mailman

Re: GIL in alternative implementations

2011-06-07 Thread Ian Kelly
On Tue, Jun 7, 2011 at 11:51 AM, Ethan Furman wrote: >> I'm not sure where he gets the idea that this has any impact on >> concurrency, though. > > What if f has two calls to self.h() [or some other function], and self.h > changes in between? > > Surely that would be a major headache. I could ima

Re: GIL in alternative implementations

2011-06-07 Thread Ethan Furman
Carl Banks wrote: On Monday, June 6, 2011 9:03:55 PM UTC-7, Gabriel Genellina wrote: En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano escribi�: On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: Python allows patching code while the code is executing. Can you give an example of w

Re: GIL in alternative implementations

2011-06-07 Thread Carl Banks
On Monday, June 6, 2011 9:03:55 PM UTC-7, Gabriel Genellina wrote: > En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano > escribi�: > > > On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: > > > >> Python allows patching code while the code is executing. > > > > Can you give an example of

Re: GIL in alternative implementations

2011-06-07 Thread Jean-Paul Calderone
On Jun 7, 12:03 am, "Gabriel Genellina" wrote: > En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano   > escribi : > > > > > > > > > > > On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: > > >> Python allows patching code while the code is executing. > > > Can you give an example of what you

Re: GIL in alternative implementations

2011-06-07 Thread Steven D'Aprano
On Tue, 07 Jun 2011 01:03:55 -0300, Gabriel Genellina wrote: > En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano > escribió: > >> On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: >> >>> Python allows patching code while the code is executing. >> >> Can you give an example of what you mean

Re: GIL in alternative implementations

2011-06-06 Thread Gabriel Genellina
En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano escribió: On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: Python allows patching code while the code is executing. Can you give an example of what you mean by this? If I have a function: def f(a, b): c = a + b d = c*3

Re: GIL in alternative implementations

2011-05-30 Thread Pascal Chambon
11 2:22 PM *To:* python-list@python.org >> Python List *Subject:* GIL in alternative implementations Hello everyone, I've already read quite a bit about the reasons for the GIL in CPython, i.e to summarize, that a more-fine graine locking, allowing real concurrency in multithreaded applic

Re: GIL in alternative implementations

2011-05-28 Thread Steven D'Aprano
On Sat, 28 May 2011 09:39:08 -0700, John Nagle wrote: > Python allows patching code while the code is executing. Can you give an example of what you mean by this? If I have a function: def f(a, b): c = a + b d = c*3 return "hello world"*d how would I patch this function while it

Re: GIL in alternative implementations

2011-05-28 Thread John Nagle
On 5/27/2011 7:06 PM, Daniel Kluev wrote: So I'd like to know: how do these other implementations handle concurrency matters for their primitive types, and prevent them from getting corrupted in multithreaded programs (if they do) ? I'm not only thinking about python types, but also primitive con

Re: GIL in alternative implementations

2011-05-28 Thread Wolfgang Rohdewald
On Samstag 28 Mai 2011, Marc Christiansen wrote: > And I wouldn't rely on 3.2 > not to break. it breaks too like it should, but only rarely like one out of 10 times i5:/pub/src/gitgames/kajongg/src$ python3.2 test.py 100 i5:/pub/src/gitgames/kajongg/src$ python3.2 test.py 100 i5:/pub/sr

Re: GIL in alternative implementations

2011-05-28 Thread Peter Otten
Daniel Kluev wrote: >> So I'd like to know: how do these other implementations handle >> concurrency matters for their primitive types, and prevent them from >> getting corrupted in multithreaded programs (if they do) ? I'm not only >> thinking about python types, but also primitive containers and

Re: GIL in alternative implementations

2011-05-28 Thread Marc Christiansen
Daniel Kluev wrote: > test.py: > > from threading import Thread > class X(object): >pass > obj = X() > obj.x = 0 > > def f(*args): > for i in range(1): > obj.x += 1 > > threads = [] > for i in range(100): >t = Thread(target=f) >threads.append(t) >t.start() > > for t

Re: GIL in alternative implementations

2011-05-27 Thread Daniel Kluev
> So I'd like to know: how do these other implementations handle concurrency > matters for their primitive types, and prevent them from getting corrupted > in multithreaded programs (if they do) ? I'm not only thinking about python > types, but also primitive containers and types used in .Net and J