Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'operator': 0.03; 'subject:Python': 0.06; 'string': 0.09; 'arguments': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'tests,': 0.09; '\xe2\x80\x94': 0.09; '"is"': 0.16; '*do': 0.16; '*values*': 0.16; 'attempt.': 0.16; 'enum': 0.16; 'fine.': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:variable': 0.16; 'header:User-Agent:1': 0.23; 'error': 0.23; 'comparing': 0.24; 'test.': 0.24; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; "doesn't": 0.30; 'getting': 0.31; 'equality': 0.31; 'values.': 0.31; 'writes:': 0.31; 'option': 0.32; 'reader': 0.33; 'objects': 0.35; 'received:com.au': 0.36; 'subject:?': 0.36; 'should': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'subject:Can': 0.60; 'matter': 0.61; 'skip:* 10': 0.61; "you've": 0.63; '8bit%:10': 0.64; 'different': 0.65; 'skip:\xe2 10': 0.65; 'media': 0.66; '8bit%:21': 0.69; 'clearer': 0.84; 'identity;': 0.84; 'received:125': 0.84; 'corporations': 0.91; 'you).': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Can global variable be passed into Python function? Date: Sat, 01 Mar 2014 21:48:40 +1100 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> <87k3ceeq0m.fsf@elektro.pacujo.net> <87zjlad8q4.fsf@elektro.pacujo.net> <874n3irz04.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: vmx15867.hosting24.com.au X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:zzqGP7KLOINx1JRL4Ot307VA580= 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393670936 news.xs4all.nl 2974 [2001:888:2000:d::a6]:58039 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67306 Marko Rauhamaa writes: > Ben Finney : > > > Since you don't care about identity, only that the objects have > > different values, you should be comparing for equality with ‘==’. > > Ok, one last attempt. > > I need *identifiers*. And, as you've realised, without an Enum pattern you have the option of using string *values* — because it's the values you want to see in error message output. The *identity* of the values doesn't matter. Any string of the given value will work fine. So don't fool the reader into thinking you actually care about object identity; don't use ‘is’ for comparing these values. Use ‘==’, since that's all that matters for getting a value that will work fine. > The same program still works (and still uses "is" for identity tests, > mind you). You have provided no justification for using an identity test. It confuses the matter by pretending you care about object identity, when you *do not* as evidenced by all your arguments so far. The equality operator ‘==’ is clearer for your purpose, and less confusing. -- \ “[Entrenched media corporations will] maintain the status quo, | `\ or die trying. Either is better than actually WORKING for a | _o__) living.” —ringsnake.livejournal.com, 2007-11-12 | Ben Finney