Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: the global keyword: Date: Wed, 22 Jun 2016 08:32:23 +1000 Lines: 15 Message-ID: References: <646e9ff9-b5a1-4403-b79a-694397e34b0b@googlegroups.com> <1466529321.3842871.644317377.08527069@webmail.messagingengine.com> <195658b2-e1b2-4c91-8ff8-bd58379e700f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Bp0U+EDimbRwEiRlIRKcXwbd4gecvQWFgP4as1tmcZxA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'semantic': 0.07; 'cc:addr :python-list': 0.09; '22,': 0.09; 'globals': 0.09; 'def': 0.13; 'wed,': 0.15; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'symbols': 0.29; 'too.': 0.30; 'received:google.com': 0.35; 'could': 0.35; 'received:209.85': 0.36; 'subject:: ': 0.37; 'johnson': 0.37; 'received:209': 0.38; 'subject:the': 0.39; 'forget': 0.60; 'chrisa': 0.84; 'subject::': 0.85; 'to:none': 0.91; 'rick': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=imaScOmNAMVoddsJyqpuTm1qD2UhFWzhEOP/NEAa1yQ=; b=RRuxW7SN2CBefB2D4jMSFphnMdK/dLzPLx3wtPFDjwp0Wy+g24//1JpJf5cDlaUHb4 YMF9iQX7JNsDg0TCe9zppou9gZnqBq93GvLjfGgUcBSwuCmlcoVhQXRelwjYfylSEd7h NLzHY9YxbqkrfnrpaXtm5KhJlRZgofPDWO92Vuvc6uu+7UcB1XsxQ2Qqrk2QbmFaUnRd +tfGzGvQFKCEl7tZFrRsfkFEg1oKW7mSIDtMRr8ZaOPXsO4PXGFSsC3IszXW8KVqWx4O hjGU1A2JPZfbl1iN+g+jn2VWITH1nts/cMUIws06j9Cf+WEKBF2GfcBR+ePP7GIAsJIg xjeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=imaScOmNAMVoddsJyqpuTm1qD2UhFWzhEOP/NEAa1yQ=; b=Zx2yYF+2dQ90BBlHEQ4RlOydGf5mUNRwgQDcyMAjmiMj7PJim2BJXCK+A82CHaLhiJ krZ2kuw7jpyK0M2J/91y/m22bj1xEwFXCD8KqspIEl95ubSVhkaHMtqhzI0tF9InWjKe tu+H2w8b6xxe7xnm+O2n2GFAujfY7d7hONPww5/Efel3I+uftys0zFdR4HO916T9ysC1 zsaqON5w4zS2dZCe14QWIk/Tpsvb0SGNJLNLBET56vJ2b7jnLOcontRuSSXCHn+orvqW WEqDbZBAmol3Ulu7srVtaJvg7Q7xIhyo2dCkAufwnqW0V+gi7Wb5pRySVeD0HhB1nWhB ZEiw== X-Gm-Message-State: ALyK8tJ618xwcjKrKaQUjys29bCYSvsHk8oOowyojwQfX493J3T3Ye0cRXjzIm5mJv4l08gEge64MAEDgjvYKQ== X-Received: by 10.194.70.41 with SMTP id j9mr14273976wju.30.1466548344346; Tue, 21 Jun 2016 15:32:24 -0700 (PDT) In-Reply-To: <195658b2-e1b2-4c91-8ff8-bd58379e700f@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <646e9ff9-b5a1-4403-b79a-694397e34b0b@googlegroups.com> <1466529321.3842871.644317377.08527069@webmail.messagingengine.com> <195658b2-e1b2-4c91-8ff8-bd58379e700f@googlegroups.com> Xref: csiph.com comp.lang.python:110271 On Wed, Jun 22, 2016 at 8:20 AM, Rick Johnson wrote: > Then one could have added module-level symbols without all > the semantic hubbub. > > MSFL.foo = 0 > > def iter_foo(): > MSFL.foo += 1 > And don't forget that you would need to call this function as MSFL.iter_foo(). Module-level functions are globals too. ChrisA