Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'nested': 0.07; 'python': 0.09; 'lookup': 0.09; 'special,': 0.09; 'aug': 0.13; 'ah,': 0.16; 'arbitrarily': 0.16; 'builtins.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lookups.': 0.16; 'subject:Objects': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'received:209.85.214.174': 0.21; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'forgot': 0.27; 'message-id:@mail.gmail.com': 0.27; 'run': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'that.': 0.30; 'point': 0.31; "aren't": 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'too.': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'potentially': 0.66; 'locals': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=dvieeGIL5Y2Td/LzbzhMRD0Ef5n327QcA/2d/xuOrSo=; b=JO0yFQkVmsvwiPrmBufsZ/+XjefUhLXrYd83VByNtkBHP73hTEdeTwfjZQKoq3wnFl LV+zhkqPFRyEQjN8mrpviJcGk2/Kih2xFGu4SJff5KnViyvWSDfCBBXVuU3fPOtL9SUH tEASt4nc1Mj7VJllnbrSdoFnBa4K4yst2v2ZI6Mjvt/KReyC99RoVpGCMJSC8LWgib1O TBzdC4Ek3vOLt1IZGyV+as+RZK8UeqmOXHM4izUMJtbJ0QLLv5diYWYQUq7HSHJtEun6 P3Hyn09x0c4T6EJXI+3WEhz+vxDqATW/XUQantwPJLnqKldCyib2fHtmRXqtFemQtpE0 XsbQ== MIME-Version: 1.0 In-Reply-To: <503a3051$0$6574$c3e8da3$5496439d@news.astraweb.com> References: <18409992-1e28-4721-8e64-60c69668da4e@googlegroups.com> <87d32i1ntc.fsf@benfinney.id.au> <7df4c317-7ad8-4158-900a-b52f19c3caf2@k9g2000pbr.googlegroups.com> <503750b9$0$6574$c3e8da3$5496439d@news.astraweb.com> <503a2804$0$6574$c3e8da3$5496439d@news.astraweb.com> <503a3051$0$6574$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 27 Aug 2012 00:54:05 +1000 Subject: Re: Objects in Python From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345992849 news.xs4all.nl 6906 [2001:888:2000:d::a6]:45422 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27928 On Mon, Aug 27, 2012 at 12:18 AM, Steven D'Aprano wrote: > Also, built-ins require a name lookup too. As you point out, locals are > special, but Python will search an arbitrarily deep set of nested > nonlocal scopes, then globals, then builtins. Ah, builtins, forgot that. So yes, global scope involves potentially two name lookups. But nonlocals aren't searched at run time. ChrisA