Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Erik Newsgroups: comp.lang.python Subject: Re: Could you explain this rebinding (or some other action) on "nums = nums"? Date: Tue, 1 Dec 2015 22:34:13 +0000 Lines: 19 Message-ID: References: <94c2e42e-1e5f-40cf-9259-26035e277bf3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de /R/Smm8h32f1sxC6fEUB2gxAWQgsKS1/CbDm/LvfCojA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'assignment': 0.07; 'bug.': 0.07; 'augmented': 0.09; 'from:addr:python': 0.16; 'mechanism.': 0.16; 'mutated': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Could': 0.16; 'wrote:': 0.16; 'element': 0.18; 'to:2**1': 0.21; 'assign': 0.22; 'originally': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'looks': 0.29; 'subject:other': 0.29; 'subject:some': 0.29; 'received:84': 0.32; 'subject:) ': 0.32; 'getting': 0.33; 'list': 0.34; 'asking': 0.35; 'but': 0.36; 'should': 0.36; 'assigned': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'fundamental': 0.66; 'denis': 0.84; 'subject:this': 0.85; 'subject:you': 0.85 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JN/GyJ+b c=1 sm=1 tr=0 a=Ypmeq7T0cKALDUsRPCToMg==:117 a=Ypmeq7T0cKALDUsRPCToMg==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=N659UExz7-8A:10 a=z2vHlgiCS6V18mFbxW0A:9 a=pILNOxqGKmIA:10 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.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: , Xref: csiph.com comp.lang.python:99824 On 01/12/15 21:37, Denis McMahon wrote: > The assignment succeeds. That's imo a bug. If it's a TypeError to try and > assign a value to tup[1], then tup[1] should not allow the mutated list > to be assigned. Nothing got assigned. That original list object remains in that slot. However, it has been mutated since it was originally assigned. But I can see what you're getting at - what you're asking for is that the *container* object whose element is being assigned to is first queried as to whether it will accept a mutated element being assigned to it before that element is mutated. This looks to be a fundamental issue with the augmented assignment mechanism. E.