Path: csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'assignment': 0.07; 'strings.': 0.09; 'subject:into': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '"is"': 0.16; '"programming': 0.16; '4:39': 0.16; 'confuse': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'identities': 0.16; 'identities.': 0.16; 'immutable,': 0.16; 'none.': 0.16; 'resource,': 0.16; 'subject:variable': 0.16; 'thursday,': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'right.': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'specifically': 0.29; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'such.': 0.31; 'values.': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'subject:?': 0.36; 'should': 0.36; 'pm,': 0.38; 'recent': 0.39; 'explain': 0.39; 'subject:Can': 0.60; 'new': 0.61; 'simple': 0.61; "you're": 0.61; 'different': 0.65; 'great': 0.65; 'between': 0.67; 'beautiful': 0.68; 'book,': 0.68; 'special': 0.74; 'distinguish': 0.84; 'careful': 0.91; '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=gOYikzIIq/+pzNC1MiK7rQ7397KQI86Scl+QevP4ZGo=; b=YlFwz/KtMuNOtI2UJ2ry2xeQiBf3o50SKa3nCI4vhvl0Zhkgmw9Gsx4zqowHh9/aFZ Maup2MpPOOPHTsHMVVuMlwoU2GlUkLoP3gXlPYdeC8VLhqa/j4MB+AjQcZYfHj1r4+IA BkcIFHS3UicPb3Tnvia8U5pPt+LMJbZPYdvsP8wwGYQ7m54MuPboBlproWq/KLSkE5ec FFYs7nBvQhPp9mcj1nM1vQvVUWuvMv86we4b00iU61+jmR+Bl85vIHyQt/H6vAjPdJvJ AJd3BL3XMlc9uI5Ad//ZOpOlyxaFU8hg7zElfKZ5DxbmVMKwF55M02raKTOJ5Ht+de8v 4uMA== MIME-Version: 1.0 X-Received: by 10.66.129.133 with SMTP id nw5mr1394894pab.98.1393566815625; Thu, 27 Feb 2014 21:53:35 -0800 (PST) In-Reply-To: <4a7700ed-835c-4e19-8c6d-ab451b696390@googlegroups.com> References: <27ac2248-0ca3-4ba6-9d25-eaad324bc5e9@googlegroups.com> <5f4f5a5f-327a-4616-8235-17ee9e74c488@googlegroups.com> <530fef58$0$11113$c3e8da3@news.astraweb.com> <4a7700ed-835c-4e19-8c6d-ab451b696390@googlegroups.com> Date: Fri, 28 Feb 2014 16:53:35 +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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393566819 news.xs4all.nl 2857 [2001:888:2000:d::a6]:53387 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67202 On Fri, Feb 28, 2014 at 4:39 PM, Mark H. Harris wro= te: > On Thursday, February 27, 2014 10:43:23 PM UTC-6, Chris Angelico wrote: > >> Simple rule of thumb: Never use 'is' with strings or ints. They're >> immutable, their identities should be their values. Playing with 'is' >> will only confuse you, unless you're specifically going for >> introspection and such. > > Right. The only time I use "is" is when I'm trying to explain to someo= ne new to python assignment what is happening inside... what Mark Summerfie= ld calls "python's beautiful heart," in his his recent book, "Programming i= n Python 3" ... a great resource, by the way. > 'is' can and should be used with mutables, to distinguish between identical values with different identities. It's also appropriate to use 'is' with special singletons like None. Just be careful of ints and strings. ChrisA