Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'element': 0.07; 'assigning': 0.09; 'booth': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'helps.': 0.16; 'subclass': 0.16; 'throw': 0.16; 'tuple': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'tuples': 0.31; 'fri,': 0.33; 'received:google.com': 0.35; 'there': 0.35; 'implement': 0.38; 'pm,': 0.38; 'enough': 0.39; 'how': 0.40; 'easy': 0.60; 'new': 0.61; 'it!': 0.67; 'mar': 0.68; "it'd": 0.84; 'to:none': 0.92 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=WgFQWZvRw3haap/jW2+/TIoiIdBKneqT73Db1eRcJps=; b=sQ16gjYA7SD58PCHsRfbj/b4cLNjkX1Mirb4FsmfsWYgmHhGiQvomHq6Z/iXXm5Rop V9MDc1Dt9uwgMrwTbTeGGVotnQJ3v79Pkw1lQjpWj/NEtC83qLcBYtUZKVQMl6XO3Y41 2S+rYv5teSoMBU1HeLIP+lg306zW29WVx+GrWk5Nd8QRzn/O5U5GeOyN8mhgVxhTPqhe cELiBP1fZb0bCiTd94+304kLFtycF58W8RrClc/f0zan0ccLUdrhHdV3k+quiYu0tFVV /RO3Dq/wWGEuk4WU3yJHFbQTBZQF0XjEXfXe4X7E5EmiwDT8NqGshrA/OLWwYuLMMTXN hkMg== MIME-Version: 1.0 X-Received: by 10.66.129.133 with SMTP id nw5mr21034522pab.98.1394190673352; Fri, 07 Mar 2014 03:11:13 -0800 (PST) In-Reply-To: References: Date: Fri, 7 Mar 2014 22:11:13 +1100 Subject: Re: Tuples and immutability 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.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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394190682 news.xs4all.nl 2915 [2001:888:2000:d::a6]:35789 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67989 On Fri, Mar 7, 2014 at 8:33 PM, Duncan Booth wrote: > Is there any reason why tuples need to throw an exception on assigning to > the element if the old value and new value are the same object? It'd be easy enough to implement your own tuple subclass that behaves that way. Try it! See how many situations it actually helps. ChrisA