Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!diablo1.news.osn.de!news.osn.de!diablo2.news.osn.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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; 'modify': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Help': 0.11; 'jan': 0.12; '"x"': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:skip:u 10': 0.16; 'subject:python': 0.16; 'attach': 0.16; 'bit': 0.19; 'module': 0.19; 'url:home': 0.24; 'looks': 0.24; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'subject:list': 0.30; 'anonymous': 0.31; 'charset:us-ascii': 0.36; 'list': 0.37; 'level': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'email addr:gmail.com': 0.63; 'name': 0.63; 'containing': 0.69; '2015': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Help understanding list operatoins inside functions in python 3 Date: Tue, 13 Jan 2015 09:25:46 -0500 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-221-234.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421159409 news.xs4all.nl 2831 [2001:888:2000:d::a6]:52967 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83697 On Tue, 13 Jan 2015 04:51:19 -0800 (PST), stephen.boulet@gmail.com declaimed the following: >I'm a bit confused why in the second case x is not [1,2,3]: > >x = [] > >def y(): > x.append(1) MODIFY contents of object identified by the name "x"; "x" is not a local name, search module (global) level to find it. > >def z(): > x = [1,2,3] Create an anonymous list containing three elements; attach the LOCAL name "x" to that list; never looks at module "x: -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/