Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'subject:Python': 0.05; 'compiler': 0.05; 'global,': 0.09; 'argument': 0.15; 'explicitly': 0.15; '"not"': 0.16; 'construct.': 0.16; 'denied,': 0.16; 'distinct': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'local.': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'wrote:': 0.16; 'say,': 0.18; 'otherwise,': 0.20; 'function,': 0.22; 'decide': 0.23; 'specified': 0.23; 'recognized': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'switch': 0.27; 'specify': 0.27; 'declared': 0.29; 'compared': 0.30; "i'd": 0.31; 'rules': 0.31; 'received:84': 0.32; 'rule': 0.33; 'traditional': 0.33; 'true.': 0.33; 'quite': 0.35; 'step': 0.36; 'but': 0.36; 'list,': 0.36; 'should': 0.36; 'needed': 0.36; '(and': 0.36; 'assigned': 0.36; 'keyword': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'sample': 0.63; 'latest': 0.64; 'within': 0.64; 'between': 0.65; 'therefore': 0.67; 'clearer': 0.84; 'distinguish': 0.84; 'proves': 0.84; '"one': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=MbeRwMLf c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=IkcTkHD0fZMA:10 a=D_u78vKoX3vIYry_F48A:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Subject: Re: Python handles globals badly. To: python-list@python.org References: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> From: MRAB Date: Sat, 12 Sep 2015 00:03:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <14afe27e-0bd5-410f-8e64-0f31d496ebf2@googlegroups.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442012638 news.xs4all.nl 23725 [2001:888:2000:d::a6]:45796 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96373 On 2015-09-11 22:26, tdev@freenet.de wrote: > Reflecting latest answers to global and "proposals" > [snip] > But you can say, the "general" sample is: > You have to specify global that the compiler can distinguish > between local and global > Other words: global is needed to distinct global from local. > > But this is "not" true. > You specify global cause you want write access. > Even the rules specified proves it: > >> 1) If it's in the function's argument list, it's an argument (and >> therefore local). >> 2) If it's explicitly declared global, then it's global. >> 3) If it's never assigned within the function, then it's global. >> 4) Otherwise, it's local. > > Take step 2 out than it is again recognized as global. > So the global keyword is not needed to distinguish global from local. > Rule 3 proves it. > I'd would rephrase 3 and 4: 1) If it's in the function's argument list, it's local. 2) If it's declared global, it's global. 3) If it's assigned within the function, it's local. 4) Otherwise, it's global. > > Conclusion. > I will use Python, but never become a Pythonier, > although quite conform with its philosophy "One best way". > But even a traditional switch is denied, although much clearer > in reading and writing than any if-else construct. > I can and will not understand it. > No-one can decide on how it should be written without it looking syntactically inconsistent in some way compared to the other control structures. > > Thanks for your answers. > >