Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'programmer': 0.03; 'interpreter': 0.05; 'assignment': 0.07; 'immutable': 0.09; 'thrown': 0.09; 'python': 0.11; 'alert': 0.16; 'enough.': 0.16; 'exception': 0.16; 'modification': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'generally': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'tuples': 0.31; 'types.': 0.31; 'supposed': 0.32; 'fri,': 0.33; 'not.': 0.33; "can't": 0.35; 'something': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'list': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'took': 0.61; 'simply': 0.61; 'mar': 0.68; 'consequences': 0.74; 'behavior': 0.77 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=+NM4UHYLjfpE63CguPiqW1AW0h6Tvlg5orTlTHuM7LM=; b=nY2LMb+1QyaeCqeQDx7Emg4+LZHugTf2J6vziNdaXnbO+Ri97rAJBTgnJmyHwDfejQ zYrTSVnB5S6OGvyQAGdVET6EAlrPsC9y+uCoeYqhXpZwGRvdG1q5737Mim/rNmhQb3lY zUYCcGLDOxbH8yltaTq8/stF9jx0c1fuAFToYc5WUKHX3/zxVcUQ7lSwD+Rsg3sZl7U4 skBHs0WUyaWZ3J+W7v50mfaVd1pOM059sESYD1SnBDxIbWrXIxP6t5UA1AevmG6mJEIM 6dqzw5trK6d3nOcSyXLb52gYQhsfwfFdU8hbyeXHhpRukTptv5141feBP2CcNlX4shXi bLww== X-Received: by 10.68.170.66 with SMTP id ak2mr23571466pbc.5.1394216630463; Fri, 07 Mar 2014 10:23:50 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4piSu.17150$NC.10985@fx27.am4> References: <4piSu.17150$NC.10985@fx27.am4> From: Ian Kelly Date: Fri, 7 Mar 2014 11:23:10 -0700 Subject: Re: Tuples and immutability To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1394216638 news.xs4all.nl 2938 [2001:888:2000:d::a6]:41460 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68003 On Fri, Mar 7, 2014 at 4:51 AM, Alister wrote: > I would think it would be better if the exception was thrown before the > assignment to the list took place > simply seeing that a modification action was being applied to a tupple > should be enough. > this would alert the programmer to the fact that he was trying something > that may have undesired consequences Then the behavior of tuples would be inconsistent with other immutable types. This can't be applied generally, because the Python interpreter doesn't generally know whether a given type is supposed to be immutable or not.