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:44:53 +0000 Lines: 23 Message-ID: References: <94c2e42e-1e5f-40cf-9259-26035e277bf3@googlegroups.com> <565E2065.1050704@lucidity.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de MQ5bfQBh6JQV/K2A8biX8QwD3NphX2JKfNRh8ieBMOtA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.040 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'immutable': 0.09; 'subsequent': 0.15; 'assignment.': 0.16; 'erik': 0.16; 'from:addr:python': 0.16; 'mutated': 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; 'explicit': 0.22; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'subject:other': 0.29; 'subject:some': 0.29; 'subject:) ': 0.32; 'point': 0.33; 'similar': 0.33; 'something': 0.35; 'asking': 0.35; 'but': 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; 'above,': 0.63; 'situation': 0.67; 'contains.': 0.84; 'subject:this': 0.85; 'subject:you': 0.85 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=bI7rW6KZ c=1 sm=1 tr=0 a=Ypmeq7T0cKALDUsRPCToMg==:117 a=Ypmeq7T0cKALDUsRPCToMg==:17 a=0Bzu9jTXAAAA:8 a=EBOSESyhAAAA:8 a=N659UExz7-8A:10 a=hczHA9gShFpHkIuQ9NoA: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: <565E2065.1050704@lucidity.plus.com> 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:99827 Apologies for self-replying, On 01/12/15 22:34, Erik wrote: > 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. What I said above is rubbish. The situation is approximately similar to: a = [4, 5, 6] t = ([1, 2, 4], a) a.append(7) a.append(8) a.append(9) The point is, you're mutating something that an immutable object contains. In the example you give, that's caught because of the subsequent explicit assignment. In the example above, it's not caught. But it's the same thing. E.