Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'next,': 0.05; 'python': 0.08; '"hello': 0.09; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'def': 0.12; 'wrote:': 0.14; 'f(a,': 0.16; 'from:addr:yahoo.com.ar': 0.16; 'iteration.': 0.16; 'lookup': 0.16; 'patching': 0.16; 'subject:GIL': 0.16; 'subject:alternative': 0.16; 'this?': 0.19; 'code': 0.24; 'function': 0.25; 'example': 0.27; 'sat,': 0.29; 'lot.': 0.30; 'patch': 0.32; 'steven': 0.32; 'header:X-Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'thinking': 0.34; 'header:User- Agent:1': 0.35; '-0700,': 0.35; "d'aprano": 0.35; 'sometimes,': 0.35; 'useful': 0.37; 'change': 0.37; 'affects': 0.37; 'think': 0.38; 'received:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'allows': 0.40; 'meaning': 0.40; 'john': 0.62; 'received:190': 0.74; '-0300,': 0.84; 'genellina': 0.84; 'gabriel': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Gabriel Genellina" Subject: Re: GIL in alternative implementations Date: Tue, 07 Jun 2011 01:03:55 -0300 References: <4DE015EA.4040600@gmail.com> <4de1252d$0$2203$742ec2ed@news.sonic.net> <4de12b4b$0$29996$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 190.2.4.25 User-Agent: Opera Mail/11.11 (Win32) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 37 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307419262 news.xs4all.nl 49174 [::ffff:82.94.164.166]:57763 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7133 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 > 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