Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; '*not*': 0.07; 'source.': 0.07; 'string': 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; 'distinct': 0.16; 'equality.': 0.16; 'finney': 0.16; 'hack,': 0.16; 'invocation': 0.16; 'lie': 0.16; 'objects.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:variable': 0.16; 'do,': 0.16; 'pointed': 0.19; 'header:User-Agent:1': 0.23; 'case.': 0.24; 'comparing': 0.24; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'point': 0.28; 'compared': 0.30; 'breaking': 0.31; 'writes:': 0.31; 'text': 0.33; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'received:com.au': 0.36; 'done': 0.36; 'subject:?': 0.36; 'so,': 0.37; 'clear': 0.37; 'ben': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'subject:Can': 0.60; 'first': 0.61; "you'll": 0.62; 'making': 0.63; 'telling': 0.64; 'skip:\xe2 10': 0.65; 'here': 0.66; 'believe': 0.68; '8bit%:43': 0.74; 'truth': 0.81; 'preventing': 0.84; 'received:125': 0.84 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 10:17:10 +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> 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:i6pQ4fTsKFxI5jFciqlB91ii3eg= 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393629442 news.xs4all.nl 2884 [2001:888:2000:d::a6]:36059 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67253 Marko Rauhamaa writes: > Ben Finney : > > > First reason: This is better done by making it clear the value is an > > arbitrary object that won't be compared for equality. Just use > > ‘object()’ to creeate each value and be done with it. That's a hack, > > but it's better than pretending you'll use the string as a string of > > text and then breaking that expectation. […] > > So, I think Marko's use case is not a justification for comparing > > string values with ‘is’. > > […] However, since any distinct objects will do, there is nothing > preventing you from using string objects. As has been pointed out to you, the whole point here is that string objects often *are not* distinct, despite conceptually having distinct cretion in the source. That's why an ‘object()’ invocation is recommended: because it *will* create distinct objects. Strings do not have that property. So strings are *not* suitable for this use case. -- \ “It is hard to believe that a man is telling the truth when you | `\ know that you would lie if you were in his place.” —Henry L. | _o__) Mencken | Ben Finney