Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; '*not*': 0.07; 'integers': 0.09; 'mutable': 0.09; 'received:internal': 0.09; 'index': 0.13; 'def': 0.14; 'argument': 0.15; "hasn't": 0.15; 'thu,': 0.15; 'value.': 0.15; 'list)': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'value:': 0.16; 'x[i]': 0.16; 'wrote:': 0.16; 'copied': 0.18; 'pass': 0.22; 'demonstrate': 0.23; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'least': 0.27; 'object,': 0.27; "doesn't": 0.28; 'array': 0.29; 'e.g.': 0.31; "d'aprano": 0.33; 'int': 0.33; 'steven': 0.33; 'subject:?': 0.34; 'changed': 0.35; 'to:addr:python-list': 0.35; 'list': 0.35; 'being': 0.36; 'received:10': 0.37; 'subject:: ': 0.37; 'received:66': 0.38; 'say': 0.38; 'mean': 0.38; 'test': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'from:no real name:2**0': 0.61; 'side': 0.62; 'header:Message-Id:1': 0.62; 'more': 0.62; 'skip:n 10': 0.63 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=seIas9scUBD5KJUaEq2jTGKm2DA=; b=uLVMtj I4ssPQcfKys+592LFNLVfxynztNGRimXLU5NDaE8sVsQZX6dQBo7tPh6QEQZsOtb WxZfYYR++Z4/TnpuxViAGGedGo+IIf5WnyEBS6VwjCQat6ohrLJ08jBf67dNBZmI t6G4krTgPe6Y1CgQIblcf5UmUxW8+vxo99qf8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=seIas9scUBD5KJU aEq2jTGKm2DA=; b=oN4bdmUlzudFG/w8/jOaBaexd1kZezPdx64T+VJF6GU15xq Mfu3XztJi1qpRyZukp/EJ6g5PFj0LDqCXZ0peNFfrhtEt+ptnGzK+s2l8BzMM7Im OiOIiIzIHJ0/3sJbtLWV4q56/aj8NaABY3lqFPztsz2Wgdx8PtfTHarEpZkc= X-Sasl-Enc: uWtE9QNP2Pc113L0voAG9lUmFNhby9RDsItdD/JQNMtA 1433439052 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-96e2a13b In-Reply-To: <557086d6$0$13011$c3e8da3$5496439d@news.astraweb.com> References: <3bbe49da-e989-4a8c-a8a9-75d3a786f508@googlegroups.com> <557056f9$0$13009$c3e8da3$5496439d@news.astraweb.com> <87a8wf5z4l.fsf@elektro.pacujo.net> <557086d6$0$13011$c3e8da3$5496439d@news.astraweb.com> Subject: Re: Can Python function return multiple data? Date: Thu, 04 Jun 2015 13:30:52 -0400 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433439055 news.xs4all.nl 2929 [2001:888:2000:d::a6]:52344 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92075 On Thu, Jun 4, 2015, at 13:11, Steven D'Aprano wrote: > You need at least one more test to prove pass by value: you need to > demonstrate that the value bound to y is copied when passed to the > function. E.g. pass a mutable value (say, a list) and mutate it inside > the > function. If the list in the outer scope is *not* mutated, then and only > then can you say it is pass by value. That's not true at all. Being able to mutate the object doesn't make it not-pass-by-value any more than being able to use an int argument as an index to mutate a global array makes the int not-pass-by-value. a = [0]*16 def f(x, i): x[i] = 3 f(a, 0) If x is not pass-by-value, then clearly i is also not pass-by-value, despite integers being immutable. Being able to use an argument to cause a side effect does not mean the argument has not been passed by value. a hasn't changed, 0 hasn't changed, the only thing that has changed is the list object, which is *not the same thing as a*.