Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6561
| 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!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'foo': 0.09; 'referenced': 0.09; 'subject:parameters': 0.09; 'def': 0.12; 'am,': 0.14; 'debugging': 0.14; 'received:209.85.214.174': 0.14; 'received :mail-iw0-f174.google.com': 0.14; 'wrote:': 0.14; '*after*': 0.16; 'angelico': 0.16; 'confusing.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'rebert': 0.16; 'subject:function': 0.16; '\xa0print': 0.16; 'traceback': 0.16; '(most': 0.16; 'mon,': 0.17; 'guess': 0.19; 'header:In-Reply- To:1': 0.21; 'variable': 0.21; 'last):': 0.23; 'message- id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'it.': 0.31; 'print': 0.31; 'to:addr:python-list': 0.33; 'error': 0.33; 'chris': 0.34; '"",': 0.35; 'assignment': 0.35; 'quite': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'to:addr:python.org': 0.39; '30,': 0.84; 'functioned': 0.84; 'road.': 0.84; 'wow': 0.84 |
| 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:content-transfer-encoding; bh=bL/sRrNEA5+/1RoGNUJm2F7qMBrDgBmOjGqg848/1SQ=; b=Sm4q5yD2uGZDGLP+othhqHWZ3sZu+/zW+8WMqqmLSPsv9uFxorETYzk2ZoPSXEu5ck j9fLM6Oiuoogurtpk24fVzHSjISqVSIOdVZSk/XWkzolGO/w8E5hrsVMmVjPkBUEHwgD VQ3UzhWzpoYr6dcD809aDnxcEBHAjKb6ioJGg= |
| 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:content-transfer-encoding; b=Eabc+Dj17zfWtqu17v3aSb1xJYdtiY31uv8gKtnJ/WUyJw8kzVgH09+1qi9mXvjLH6 JTZZexdpsyGlOh1ts1Yb4M9HdeVfULxSw829LUKBvNHTj1sqgo18L0PPvfR6l1c9YPN7 NgrSi1sO/ROOUiKT+iD2bK+TBfwIIndZMvwj8= |
| MIME-Version | 1.0 |
| In-Reply-To | <BANLkTimWP+jP0s5DsBaFbv6LV5OTYA8hQw@mail.gmail.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> <BANLkTinK=dHCbocURD2+s5uvdonBkS+uFQ@mail.gmail.com> <BANLkTimWP+jP0s5DsBaFbv6LV5OTYA8hQw@mail.gmail.com> |
| Date | Mon, 30 May 2011 04:38:26 +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 |
| Content-Transfer-Encoding | quoted-printable |
| 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.2233.1306694309.9059.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306694309 news.xs4all.nl 49184 [::ffff:82.94.164.166]:33842 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6561 |
Show key headers only | View raw
On Mon, May 30, 2011 at 4:01 AM, Chris Rebert <clp2@rebertia.com> wrote: > def foo(): > print bar > bar = 42 > > foo() > > ===> > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "<stdin>", line 2, in foo > UnboundLocalError: local variable 'bar' referenced before assignment Wow I thought it basically functioned top-down. You get a different error on the print line if there's a "bar = 42" *after* it. This could make debugging quite confusing. Guess it's just one of the consequences of eschewing variable declarations. Sure it's easier, but there's complications down the road. Chris Angelico
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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