Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6702
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <wolfgang@rohdewald.de> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'parameter': 0.05; 'received:localnet': 0.07; 'subject:two': 0.07; 'python': 0.08; 'object.': 0.09; 'reference)': 0.09; 'subject:parameters': 0.09; 'def': 0.12; 'described': 0.14; 'wrote:': 0.14; 'defined': 0.14; '"global"': 0.16; '(when': 0.16; 'changed,': 0.16; 'from:addr:rohdewald.de': 0.16; 'from:addr:wolfgang': 0.16; 'from:name:wolfgang rohdewald': 0.16; 'local.': 0.16; 'message- id:@rohdewald.de': 0.16; 'parameter,': 0.16; 'received:91.62': 0.16; 'reply-to:addr:rohdewald.de': 0.16; 'reply- to:addr:wolfgang': 0.16; 'scope.': 0.16; 'subject:function': 0.16; 'wolfgang': 0.16; 'language': 0.18; 'accessible': 0.19; 'header :In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'maybe': 0.23; '(and': 0.25; 'function': 0.25; 'object': 0.26; '(you': 0.29; 'effect': 0.29; 'explicitly': 0.29; 'variables': 0.29; 'nested': 0.30; 'outer': 0.30; 'changes': 0.30; 'sort': 0.31; 'calling': 0.31; 'seem': 0.32; 'steven': 0.32; 'to:addr:python-list': 0.33; 'things': 0.33; 'points': 0.34; 'header:User-Agent:1': 0.35; 'languages': 0.35; 'problems': 0.36; 'charset:us-ascii': 0.36; 'change': 0.37; 'another': 0.37; 'url:python': 0.38; 'could': 0.38; 'url:org': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'subject: (': 0.39; 'unless': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'header:Message-Id:1': 0.62; 'link': 0.64; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'encountered': 0.73; 'url:tutor': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; t=1306818797; l=1262; s=domk; d=rohdewald.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:Reply-To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=/Rc3NYo0CXCNOsvIlLVE3XnoLwo=; b=pcm5bj3aJPSSbuDu0XAFmJ04FWtHSAShSL+fabsv1lCjIC7EB5zyyc6vxREtSDpkDky SQeIcReQ47YD5U/GQrRplCENPgb3BGmg3TkJxbEM661zEiOp8zu4DltUhF148Bc+meNbQ vaXcm+isxiDVSzdzFYQKZqx9bbInNKFIZEU= |
| X-RZG-AUTH | :O2MIc0epdfgAjoV+frHI3UhxNCLBO5P+YS73lHhJYRD2uAuzaM+5N8MTpOrpK3il |
| X-RZG-CLASS-ID | mo00 |
| From | Wolfgang Rohdewald <wolfgang@rohdewald.de> |
| To | python-list@python.org |
| Subject | Re: scope of function parameters (take two) |
| Date | Tue, 31 May 2011 07:13:24 +0200 |
| User-Agent | KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.3; x86_64; ; ) |
| References | <F8395F78-615E-4FBD-B6FC-1D6173EAEA45@mcgill.ca> <F4EAD1ED-563D-4D6E-A50C-68308A9F26B7@mcgill.ca> |
| In-Reply-To | <F4EAD1ED-563D-4D6E-A50C-68308A9F26B7@mcgill.ca> |
| MIME-Version | 1.0 |
| Content-Type | Text/Plain; charset="us-ascii" |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | wolfgang@rohdewald.de |
| 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.2296.1306818800.9059.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1306818800 news.xs4all.nl 49038 [::ffff:82.94.164.166]:44664 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:6702 |
Show key headers only | View raw
On Dienstag 31 Mai 2011, Henry Olders wrote: > What I would like is that the variables which are included in > the function definition's parameter list, would be always > treated as local to that function (and of course, accessible > to nested functions) but NOT global unless explicitly defined > as global. This would prevent the sort of problems that I > encountered as described in my original post. the parameter is local but it points to an object from an outer scope - that could be the scope of the calling function or maybe the global scope. So if you change the value of this parameter, you change that object from outer scope. But the parameter itself is still local. If you do def fnc2(c): c = 5 the passed object will not be changed, c now points to another object. This is different from other languages where the "global" c would change (when passing c by reference) what you really seem to want is that a function by default cannot have any side effects (you have a side effect if a function changes things outside of its local scope). But that would be a very different language than python did you read the link Steven gave you? http://mail.python.org/pipermail/tutor/2010-December/080505.html -- Wolfgang
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: scope of function parameters (take two) Wolfgang Rohdewald <wolfgang@rohdewald.de> - 2011-05-31 07:13 +0200
csiph-web