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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'value,': 0.03; 'subject:Python': 0.05; 'sys': 0.05; '*not*': 0.07; 'read-only': 0.07; 'mutable': 0.09; 'unexpected': 0.09; 'cc:addr:python-list': 0.10; 'argument': 0.15; 'value.': 0.15; 'copying.': 0.16; 'echo': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'list)': 0.16; 'value:': 0.16; 'wrote:': 0.16; 'case.': 0.18; 'copied': 0.18; 'passes': 0.18; 'language': 0.19; 'discussion': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'minor': 0.22; 'pass': 0.22; 'am,': 0.23; '2015': 0.23; 'demonstrate': 0.23; 'header:In-Reply-To:1': 0.24; 'least': 0.27; 'message- id:@mail.gmail.com': 0.28; 'skip:( 20': 0.28; 'appear': 0.29; 'arrays': 0.29; 'cat': 0.29; 'array': 0.29; 'function': 0.30; 'work.': 0.30; 'e.g.': 0.31; 'fri,': 0.31; 'seconds': 0.31; "can't": 0.32; '"the': 0.32; 'implement': 0.32; 'knows': 0.32; 'skip:p 30': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'though.': 0.33; 'subject:?': 0.34; 'received:google.com': 0.34; 'list': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'say': 0.38; 'means': 0.39; 'test': 0.39; 'performance': 0.39; 'even': 0.61; 'real': 0.61; 'more': 0.62; 'real-world': 0.66; 'skip:$ 10': 0.67; 'million': 0.73; '100': 0.79; 'array();': 0.84; 'chrisa': 0.84; "it'd": 0.84; 'timing.': 0.84; 'to:none': 0.90; 'imagine': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Y7J4ZVMhzDZWZ5uCgBIDyjdyDwbMf8nsEr/jp1we6Hg=; b=yLifZNnn9Ub59FYEXA5LY2UvBySKHD2m5rmjc/woWHGTpPF9cI9QUfIvOMzpqK4ZZF xhrlyhwdFoRWjOknoT27sUiVfFE4Y3kFfSxE6h7jGIZUrRyzPTKcvyijTZTt+dtIABwq RneRbY2G06LzAT4o7mYObMSawV6z3M0jAkB+izPwN5XXNCqpxnOeroIh6Cuxp91XjYdL OsZJrcPZoqVU4wuUZWBwxZnF38e569RxQaYVdP2Iuc+frgLMWHrIQTfcRpvsxq2mR1Dg 0ymTzKJpT6L0Ik4Yjsl6/KAZNAb6TR6lVpBvXRWgdipZmnlLt+tEh51O+n1lm/nJ72/T AV3g== MIME-Version: 1.0 X-Received: by 10.107.160.141 with SMTP id j135mr132990ioe.43.1433454266078; Thu, 04 Jun 2015 14:44:26 -0700 (PDT) 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> Date: Fri, 5 Jun 2015 07:44:25 +1000 Subject: Re: Can Python function return multiple data? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433454275 news.xs4all.nl 2951 [2001:888:2000:d::a6]:33356 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92092 On Fri, Jun 5, 2015 at 3:11 AM, 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. Minor quibble: This discussion is about semantics, not timing. A language can use pass-by-value but with optimizations for the read-only case. $ cat array_argument.php