Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!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.054 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; '34,': 0.09; 'python': 0.11; 'def': 0.12; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'print': 0.22; 'header :User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'workaround': 0.31; 'subject:?': 0.36; 'changing': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'more': 0.64; 'wish': 0.70 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Sat, 29 Jun 2013 07:56:31 -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: Closures in leu of pointers? References: <2a2072e3-4b12-4ada-872c-1240d2379928@googlegroups.com> <2603336f-e9d2-441a-8535-957d8fec2002@googlegroups.com> In-Reply-To: <2603336f-e9d2-441a-8535-957d8fec2002@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372514206 news.xs4all.nl 15991 [2001:888:2000:d::a6]:40619 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49419 On 06/29/2013 05:44 AM, cts.private.yahoo@gmail.com wrote: > Alas, one reason it's a weak workaround is that it doesn't work - at least, not how I wish it would: > > > $ cat ptrs > > x = 34 > > def p1 (a1): > > a1[0] += 12 > > p1 ([x]) > > print (x) > > $ python ptrs > 34 you'll have to use it more like this (and also changing your names to be a bit more sane): x = [ 34, ] def test_func( out ): out[0] += 12 test_func(x) print (x)