Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'variable,': 0.07; 'mutable': 0.09; 'python': 0.11; 'def': 0.14; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'whatsoever': 0.16; 'wrote:': 0.16; 'passes': 0.18; 'say,': 0.18; 'variable': 0.20; '(a)': 0.22; 'referring': 0.22; 'passing': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.25; 'header:User- Agent:1': 0.26; 'not.': 0.27; 'argue': 0.29; 'prints': 0.29; 'function': 0.30; 'print': 0.31; 'changing': 0.34; 'subject:?': 0.34; 'wrong': 0.35; 'message-id:@gmail.com': 0.35; 'to:addr :python-list': 0.35; 'list': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'received:org': 0.38; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'easily': 0.39; 'received:192': 0.39; 'sure': 0.40; 'why': 0.40; 'within': 0.64; 'email addr:gmail.com': 0.64; 'charset:windows-1252': 0.65 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 04 Jun 2015 08:16:58 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Can Python function return multiple data? References: <3bbe49da-e989-4a8c-a8a9-75d3a786f508@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433427425 news.xs4all.nl 2959 [2001:888:2000:d::a6]:36344 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92058 On 06/03/2015 04:28 PM, sohcahtoa82@gmail.com wrote: > > People actually argue that Python passes by value? This is easily > proven wrong by passing a mutable object to a function and changing > it within the function. Sure but if you reassign the variable that was passed it, it has no effect whatsoever on the caller's variable, mutable or not. This is why people argue for "pass by value." Because of this confusion, we often say, "pass by object." For example def foo(bar): bar.append(5) bar = 6 #bar is no longer referring to a list a=[1,2,3,4] foo(a) print (a) # prints [1,2,3,4,5]