Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'modify': 0.04; 'subject:Python': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'assignment': 0.07; 'tmp': 0.07; 'behave': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.14; 'argument': 0.15; '05/06/2015': 0.16; 'really?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.16; "shouldn't": 0.18; 'language': 0.19; '>>>': 0.20; 'so.': 0.22; 'lawrence': 0.22; 'am,': 0.23; '2015': 0.23; 'passing': 0.23; "i've": 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'that.': 0.30; 'fri,': 0.31; "i'd": 0.31; 'code': 0.31; 'language.': 0.32; "d'aprano": 0.33; 'steven': 0.33; 'surprised': 0.33; 'subject:?': 0.34; 'to:addr :python-list': 0.35; 'list': 0.35; 'but': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'difference': 0.38; 'received:org': 0.38; 'means': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'mark': 0.40; 'our': 0.64; 'charset:windows-1252': 0.65; 'overall': 0.70; '(also,': 0.84; 'pythonistas,': 0.84; 'received:2': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Can Python function return multiple data? Date: Fri, 05 Jun 2015 02:40:48 +0100 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> <5570dbaa$0$12995$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-195-141.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433468465 news.xs4all.nl 2827 [2001:888:2000:d::a6]:47599 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92112 On 05/06/2015 01:16, BartC wrote: > On 05/06/2015 00:13, Steven D'Aprano wrote: >> On Fri, 5 Jun 2015 06:52 am, BartC wrote: >> >>> On 04/06/2015 18:11, Steven D'Aprano wrote: >>> >>>> If there is >>>> any language where assignment uses one style and argument passing >>>> always >>>> uses another, I've never come across it. >>> >>> My language does that. I'd be very surprised if it was the only one in >>> existence that does so. >> >> I would be. That means that >> >> func(x) >> >> and >> >> tmp = x >> func(tmp) >> >> behave differently, > > Not as far as func() is concerned. But overall there is a difference > because now tmp contains a copy of x. (Also, if x contains a list for > example, func() can modify the copy in tmp, not in x. But this shouldn't > be surprised because the code is different!) > Really? >>> x=[1,2,3] >>> tmp=x >>> def func(thing): ... thing.clear() ... >>> func(tmp) >>> tmp [] >>> x [] -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence