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


Groups > comp.lang.python > #6555

Re: scope of function parameters

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'function,': 0.07; 'subject:parameters': 0.09; 'pm,': 0.10; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; 'angelico': 0.16; 'curious,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'namespace.': 0.16; 'namespace?': 0.16; 'subject:function': 0.16; "wouldn't": 0.17; 'header:In-Reply- To:1': 0.21; 'found,': 0.23; 'code': 0.24; 'example': 0.27; "i'm": 0.27; 'message-id:@mail.gmail.com': 0.28; 'raise': 0.28; 'received:209.85.214': 0.28; 'sun,': 0.30; 'steven': 0.32; 'to:addr:python-list': 0.33; "i've": 0.33; 'chris': 0.34; "d'aprano": 0.35; 'trigger': 0.35; 'assigned': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; 'subject:: ': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; '10:47': 0.84; 'now...': 0.84; 'this...': 0.84; 'local,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=RavHusu7IUXpwRCOKzbbu8yvXH/rEqzKVuxQq9cu2UM=; b=mcWMO8WPqjQaQuZEh10/r1lgb2yOwtBqDXnfPzSdAYhH8Z4H+HzI3LxS3cTlPGrihY D/geXtOCsO3smkt9lZpdNzCgwHI9VnD/c/W/b0ZwhPiIPepT/foY179IQEcEXF/2Qmv/ eptez6pnZTV8RdYqlvAVRN21C/5zy020vwbtk=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=c7irTiFsQalDD3DYXwtR0LRed4xHJSuHEcp7eYzPwwRB+baYc7e0i8sSwce8Te1NE4 UpelRjlPU4Xy9dF9I7lf1S082NC8C1SA7kyRllbbpXZJ9sN+wxA9hQQFWR2X2w8saV+G HaptwaMKeUzR075/PGJJ9tnT16li5pcM9WuUw=
MIME-Version 1.0
In-Reply-To <4de24045$0$29996$c3e8da3$5496439d@news.astraweb.com>
References <F8395F78-615E-4FBD-B6FC-1D6173EAEA45@mcgill.ca> <mailman.2217.1306662671.9059.python-list@python.org> <4de24045$0$29996$c3e8da3$5496439d@news.astraweb.com>
Date Mon, 30 May 2011 03:53:24 +1000
Subject Re: scope of function parameters
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2229.1306691607.9059.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 82.94.164.166
X-Trace 1306691608 news.xs4all.nl 49045 [::ffff:82.94.164.166]:59580
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:6555

Show key headers only | View raw


On Sun, May 29, 2011 at 10:47 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> If a name is assigned to anywhere in the function, treat it as a local,
> and look it up in the local namespace. If not found, raise
> UnboundLocalError.
>

Wait wha? I've never seen this... wouldn't it just create it in the
local namespace?

Can you give example code that will trigger this error? I'm curious, now...

Chris Angelico

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


Thread

Re: scope of function parameters Wolfgang Rohdewald <wolfgang@rohdewald.de> - 2011-05-29 11:47 +0200
  Re: scope of function parameters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-29 12:47 +0000
    Re: scope of function parameters Chris Angelico <rosuav@gmail.com> - 2011-05-30 03:53 +1000
      Re: scope of function parameters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-29 18:28 +0000
    Re: scope of function parameters Chris Rebert <clp2@rebertia.com> - 2011-05-29 11:01 -0700
    Re: scope of function parameters Chris Angelico <rosuav@gmail.com> - 2011-05-30 04:38 +1000
      Re: scope of function parameters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-29 18:53 +0000
        Re: scope of function parameters Chris Angelico <rosuav@gmail.com> - 2011-05-30 05:20 +1000
    Re: scope of function parameters Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-29 13:12 -0600

csiph-web