Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'static': 0.04; 'classes,': 0.05; 'subject:Python': 0.06; 'methods,': 0.09; 'subject:into': 0.09; 'cc:addr:python-list': 0.11; '12:59': 0.16; 'called.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'magic': 0.16; 'margin': 0.16; 'metaclass': 0.16; 'subject:variable': 0.16; 'prevent': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'example': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'anyone': 0.31; 'class': 0.32; 'quite': 0.32; 'beyond': 0.35; 'received:google.com': 0.35; 'idle': 0.36; 'subject:?': 0.36; 'being': 0.38; 'pm,': 0.38; 'does': 0.39; 'subject:Can': 0.60; 'reach': 0.63; 'benefit': 0.68; 'mar': 0.68; 'actually,': 0.84; 'quicker': 0.84; 'to:none': 0.92; 'state.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=46PC4+/xB4FHzXVeQZictatz/w6nyQl1gl9ea8EHCRk=; b=sEJxzi8oUGL4f69dDMb1+TfEUVhHOHvNdEONgReHhb4MnRCf81SwBAhC/wWjwi04iB onxBT27QLnx5Q2s4KnG9YlPvzCX+V8hvjVkYUbe31bJHB882YvBB5BqMT16cldkUYdwE ptzqECuAdQdTpNfJgvtExQctru/1VXwGAQaIBm5mDlJ5y1E1jtSPuZYU8zNWnsOfdKKf CdqpTCbavf7I9LBwDBh2GVdYD3E7Ft/ISxKZJAUSMq+JJV2Dic2zxYcWpged8ZW5HTzW 0JPcN89ArkQGtuuHmAiaHQOjmMb88Jvdu/RgRjQl5s693zgSajiGoMhSynPKTyRPiF7g sheA== MIME-Version: 1.0 X-Received: by 10.68.112.164 with SMTP id ir4mr6903404pbb.153.1393639433780; Fri, 28 Feb 2014 18:03:53 -0800 (PST) In-Reply-To: <53113f1b$0$29985$c3e8da3$5496439d@news.astraweb.com> References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <5f4f5a5f-327a-4616-8235-17ee9e74c488@googlegroups.com> <530fef58$0$11113$c3e8da3@news.astraweb.com> <871tynznpd.fsf@elektro.pacujo.net> <53104798$0$11113$c3e8da3@news.astraweb.com> <87ha7jy2qs.fsf@elektro.pacujo.net> <5310b031$0$29985$c3e8da3$5496439d@news.astraweb.com> <87iorzf4ro.fsf@elektro.pacujo.net> <531115e1$0$29985$c3e8da3$5496439d@news.astraweb.com> <87ob1qeqe0.fsf@elektro.pacujo.net> <53112d71$0$29985$c3e8da3$5496439d@news.astraweb.com> <874n3ienhd.fsf@elektro.pacujo.net> <53113f1b$0$29985$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 1 Mar 2014 13:03:53 +1100 Subject: Re: Can global variable be passed into Python function? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393639437 news.xs4all.nl 2888 [2001:888:2000:d::a6]:37861 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67283 On Sat, Mar 1, 2014 at 12:59 PM, Steven D'Aprano wrote: > However, the example as given won't quite work. You never instantiate the > Idle etc. classes, which means the methods won't work. You need to make > them class methods or static methods, or perform some metaclass magic > prevent them from being turned into instance methods when called. Actually, he does - setting a state means instantiating that state. I still don't see where the benefit is, beyond that you reach the right margin quicker than anyone else does. ChrisA