Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed1.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'operator': 0.03; 'assignment': 0.07; 'variables': 0.07; 'to)': 0.09; 'works.': 0.09; 'python': 0.11; 'question.': 0.14; '"is"': 0.16; 'a),': 0.16; 'before.': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'list)': 0.16; 'mylist': 0.16; 'nick': 0.16; 'language': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'copied': 0.24; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'am,': 0.29; 'thus': 0.29; 'statement': 0.30; '(since': 0.31; 'names.': 0.31; 'object.': 0.31; 'yes.': 0.31; 'class': 0.32; 'url:python': 0.33; 'there,': 0.34; 'really': 0.36; 'url:org': 0.36; 'two': 0.37; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'url:3': 0.61; 'back': 0.62; 'act': 0.63; 'name': 0.63; 'subject:gets': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.84; 'whereas': 0.91 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Sat, 15 Jun 2013 09:53:15 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: A certainl part of an if() structure never gets executed. References: <2bc90d3b-09c2-4315-9357-ff7f039465e0@googlegroups.com> <51b926a3$0$29997$c3e8da3$5496439d@news.astraweb.com> <51ba6e92$0$29997$c3e8da3$5496439d@news.astraweb.com> <51bb454c$0$29997$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371311603 news.xs4all.nl 15864 [2001:888:2000:d::a6]:36775 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48313 On 06/15/2013 07:07 AM, Nick the Gr33k wrote: > result = mylist (since its a no-emoty list) > >>>>> result.append('bar') >>>>> result is mylist >> True > > Never seen the last statement before. What does that mean? > result is mylist ???? Yes. Surprisingling good question. http://docs.python.org/3.3/reference/expressions.html#is http://docs.python.org/3/reference/datamodel.html One thing that you may find interesting is that what we often call variables in Python, and which from your code's point of view look and act like variables are in fact names. Whereas in C, assignment can be thought of as copy (a = b in C means that b's value is copied to a), in Python assignment is associating a name with an object. Thus a = b in Python means that now the names a and b both are bound (reference to) the same object. That's why the "is" operator is there, to help one know if two names point to the same object. I bring this up on the list from time to time because I find it really interesting and intellectually appealing the way Python works. Hearkens back to my class at uni on programming language theory.