Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.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.041 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'assignment': 0.07; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mutated': 0.16; 'top-level': 0.16; 'url:faq': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'cc:addr:python.org': 0.22; 'faq': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'raised': 0.31; 'probably': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'add': 0.35; 'url:org': 0.36; 'url:3': 0.61; 'such': 0.63; 'more': 0.64; 'mar': 0.68; 'entry,': 0.84; 'presumably': 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=oddkMxEY7qtI/W6hEU+Rc6ymmEj1TdYZPJNZkILG7IQ=; b=W5RIK0F4TiXrq/59RcAH/mly0/6yeOJXF+xMb+OfOVqU9UFAJ+UuqbMTaxTDHJ6pvV DkY+r7U1ubItFX38JbKjzgpd8uBst1y2PZVghOuHYzfwN2JV/o3FgmDzdtlCYmgfz6WP hW2q65ArwkL7mHvt1+o7JHIdBnZR8aKbzRLc+OEwCugv6us5Le6AFnmTEs5dvIyupqxu NzqdmR3FKcWaD9Wfa/olCEMl5QzNsYKiXVaUqygTkXf+Koqv65Csly59Q4n4oFTlhXv1 uDLqOAXe908dV7i3Q6YVn82d1ngSEUOaQ29L/xvwkUKqD7NKr9K5oWWRACiXGYEeWyNa hnHw== MIME-Version: 1.0 X-Received: by 10.66.102.39 with SMTP id fl7mr3818573pab.43.1393598635106; Fri, 28 Feb 2014 06:43:55 -0800 (PST) In-Reply-To: References: Date: Sat, 1 Mar 2014 01:43:55 +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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393598638 news.xs4all.nl 2879 [2001:888:2000:d::a6]:60396 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67227 On Sat, Mar 1, 2014 at 1:41 AM, Joshua Landau wrote: > Would it be better to add a check here, such that if this gets raised > to the top-level it includes a warning ("Addition was inplace; > variable probably mutated despite assignment failure")? That'd require figuring out whether or not the variable was actually mutated, and that's pretty hard to work out. So there's a FAQ entry, which Zachary already posted: http://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works Also, we just answer this question every now and then :) Presumably more often on -tutor than here. ChrisA