Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7133

Re: GIL in alternative implementations

From "Gabriel Genellina" <gagsl-py2@yahoo.com.ar>
Subject Re: GIL in alternative implementations
Date 2011-06-07 01:03 -0300
References <4DE015EA.4040600@gmail.com> <mailman.2185.1306548406.9059.python-list@python.org> <4de1252d$0$2203$742ec2ed@news.sonic.net> <4de12b4b$0$29996$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.2518.1307419262.9059.python-list@python.org> (permalink)

Show all headers | View raw


En Sat, 28 May 2011 14:05:16 -0300, Steven D'Aprano  
<steve+comp.lang.python@pearwood.info> 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
>     return "hello world"*d
>
>
> how would I patch this function while it is executing?

I think John Nagle was thinking about rebinding names:


def f(self, a, b):
   while b>0:
     b = g(b)
     c = a + b
     d = self.h(c*3)
   return "hello world"*d

both g and self.h may change its meaning from one iteration to the next,  
so a complete name lookup is required at each iteration. This is very  
useful sometimes, but affects performance a lot.

-- 
Gabriel Genellina

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: GIL in alternative implementations Daniel Kluev <dan.kluev@gmail.com> - 2011-05-28 13:06 +1100
  Re: GIL in alternative implementations Marc Christiansen <usenet@solar-empire.de> - 2011-05-28 11:55 +0200
    Re: GIL in alternative implementations Wolfgang Rohdewald <wolfgang@rohdewald.de> - 2011-05-28 13:16 +0200
  Re: GIL in alternative implementations John Nagle <nagle@animats.com> - 2011-05-28 09:39 -0700
    Re: GIL in alternative implementations Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-28 17:05 +0000
      Re: GIL in alternative implementations "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-06-07 01:03 -0300
        Re: GIL in alternative implementations Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-07 07:09 +0000
        Re: GIL in alternative implementations Jean-Paul Calderone <calderone.jeanpaul@gmail.com> - 2011-06-07 05:07 -0700

csiph-web