Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'assignment': 0.07; 'matches': 0.07; 'string': 0.09; 'parameter': 0.09; 'subject:into': 0.09; 'cc:addr:python-list': 0.11; 'comparison.': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'preserve': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'comparing': 0.24; 'cc:2**0': 0.24; 'references': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'object.': 0.31; '(including': 0.33; 'not.': 0.33; 'common': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'false': 0.36; 'subject:?': 0.36; 'positive': 0.37; 'being': 0.38; 'ben': 0.38; 'negative': 0.60; 'subject:Can': 0.60; 'no.': 0.61; 'course': 0.61; 'telling': 0.64; 'mar': 0.68; 'guaranteed': 0.75; 'to:none': 0.92 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:content-transfer-encoding; bh=oCdmWTS5BVpTxQdnAmsVX49lXqnomZ3ejhlrroVXIoE=; b=LF0JioGoY4jDGyumWyLGBvhdNpPStPKpaRleFW4b+RGALwZI4Xs3YXT3Qa1vlC+e9K JF412A/+kUrB5A1qGgVh2U3RVcHAOmsLneea6RTFyoiymo09KsSgv31Gl/32guxVlzGR 1p/qzJ/X2GUrOuyhyzVZHFfXXYBJ483fN4r6QhYx4nINtWkAU+JqudZkdKrUmKuEPQzm Zc2BlxG6apKtpFfTwMwtnm+03XkgJLCFsqL7+Xnxt9FdeNLCQuMaY+kx3GLdJeVDYFEg iSIVEaxrBgjtts8MPAB2zEQIysqCUoLbLrzbkL5gwv7vmBI/POipZkx9fJfj/wZ9NGkA wwEg== MIME-Version: 1.0 X-Received: by 10.66.161.38 with SMTP id xp6mr331090pab.145.1393695041325; Sat, 01 Mar 2014 09:30:41 -0800 (PST) In-Reply-To: <87r46l96j6.fsf@elektro.pacujo.net> 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> <87k3ceqhti.fsf@elektro.pacujo.net> <87r46l96j6.fsf@elektro.pacujo.net> Date: Sun, 2 Mar 2014 04:30:41 +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 Content-Transfer-Encoding: quoted-printable 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393695050 news.xs4all.nl 2836 [2001:888:2000:d::a6]:54184 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67326 On Sun, Mar 2, 2014 at 4:23 AM, Marko Rauhamaa wrote: > Ben Finney : > >> No. I'm telling you that =E2=80=98is=E2=80=99 is *wrong* for comparing s= trings, >> because it is unreliable. > > No, it isn't as long as the string object references have a common > assignment "pedigree." Assignment (including parameter passing) is > guaranteed to preserve identity of any object. Of course it is, but your identity tests also depend on there NOT being a common object when there is NOT an "assignment pedigree". The positive is guaranteed; the negative is not. And if you don't care about a false positive - that is, that some other string with the same value matches - then what you actually want is equality, not identity, comparison. ChrisA