Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; 'say,': 0.05; '*args,': 0.09; 'arguments': 0.09; 'friday,': 0.09; 'function,': 0.09; "people's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tackle': 0.09; 'python': 0.11; 'def': 0.12; '(1,': 0.16; '(2,': 0.16; '12:50': 0.16; 'accepts': 0.16; 'btw:': 0.16; 'ellipses': 0.16; 'enough?': 0.16; 'mean,': 0.16; 'modified.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'situation.': 0.16; 'tuple.': 0.16; 'vanishingly': 0.16; 'exception': 0.16; 'all.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'example': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'propose': 0.24; 'received:comcast.net': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'function': 0.29; 'leave': 0.29; 'am,': 0.29; 'points': 0.29; 'raise': 0.29; 'returned': 0.30; "i'm": 0.30; 'getting': 0.31; 'tuples': 0.31; 'lists': 0.32; 'everyone': 0.33; 'period': 0.33; 'actual': 0.34; 'problem': 0.35; 'agree': 0.35; 'common': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'doubt': 0.36; 'returning': 0.36; 'surely': 0.36; 'done': 0.36; 'should': 0.36; 'so,': 0.37; 'too': 0.37; 'list': 0.37; 'step': 0.37; 'problems': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'how': 0.40; 'ian': 0.60; 'first': 0.61; 'great': 0.65; 'debate': 0.68; 'caused': 0.69; 'containing': 0.69; 'extreme,': 0.84; 'here...': 0.84; 'inherent': 0.84; 'proposals.': 0.84; 'that)': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: Tuples and immutability Date: Sat, 01 Mar 2014 12:56:24 -0500 References: <059a3d10-453a-40fd-99f9-33ceb8ecabf7@googlegroups.com> <2ddad91d-e188-4fd0-be1c-ed30edbf280b@googlegroups.com> <2c38b941-9f3f-485f-9e97-525f28c5453a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: c-50-133-228-126.hsd1.ma.comcast.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <2c38b941-9f3f-485f-9e97-525f28c5453a@googlegroups.com> 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393696597 news.xs4all.nl 2875 [2001:888:2000:d::a6]:39138 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67329 On 3/1/14 12:50 AM, Mark H. Harris wrote: > On Friday, February 28, 2014 11:34:56 PM UTC-6, Ian wrote: > >> One very common example of tuples containing lists is when lists are >> passed to any function that accepts *args, because the extra arguments >> are passed in a tuple. A similarly common example is when returning >> multiple objects from a function, and one of them happens to be a >> list, because again they are returned in a tuple. > >> def f(*args): >> print(args) >> return (args[1:] >> >> >>> result = f(1, 2, 3, [4, 5]) >> (1, 2, 3, [4, 5]) >> >>> print(result) >> (2, 3, [4, 5]) > > I agree Ian... good points all. ... again, I'm not arguing with anyone... just saying that an error (whatever we mean by that) should not half-way-fail.... we are only pointing out the problem... we have not idea what the solution is yet. > > Intuitively everyone can see that there is a problem here... the debate cannot be answered either because of the inherent design of python (almost all of which we love). So, as they say, what is a mother to do? ... I mean, some people's kids... > > I don't know how I propose to handle the problem... I think the first step is getting everyone to agree that there IS a problem... then debate how to tackle the solution proposals. > > marcus > Everyone can agree that it is not great to raise an exception and also leave the list modified. But I very much doubt that anything will be done to change the situation. All of the solutions are too extreme, and bring their own infelicities, and the actual problems caused by this scenario are vanishingly small. BTW: I also am mystified why you uses ellipses to end your sentences, surely one period would be enough? :) -- Ned Batchelder, http://nedbatchelder.com