Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Random832 Newsgroups: comp.lang.python Subject: Re: Suggestion: make sequence and map interfaces more similar Date: Wed, 30 Mar 2016 08:50:22 -0400 Lines: 27 Message-ID: References: <56f8836b$0$1602$c3e8da3$5496439d@news.astraweb.com> <56FA8C71.4050306@rece.vub.ac.be> <56fb677f$0$11121$c3e8da3@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 4IoD1hKD36Zyjm2AjjuLtATYOSSu4rF4ZHJ4zmuQb9iQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:internal': 0.09; 'stable.': 0.09; 'violates': 0.09; 'wed,': 0.15; 'argument': 0.15; '*other*': 0.16; 'deletions': 0.16; 'insertions': 0.16; 'keys.': 0.16; 'mapping,': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'pairs': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:interfaces': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; "shouldn't": 0.18; 'changes': 0.20; 'keys': 0.22; 'seems': 0.23; 'insert': 0.23; 'replacing': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'example': 0.26; 'point.': 0.27; 'values': 0.28; 'directly,': 0.29; 'key,': 0.29; 'somebody': 0.30; "can't": 0.32; 'useful': 0.33; "d'aprano": 0.33; 'operations.': 0.33; 'steven': 0.33; 'values.': 0.33; 'that,': 0.34; 'mapping': 0.35; 'stable': 0.35; "isn't": 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'being': 0.37; 'method': 0.37; 'say': 0.37; 'associated': 0.38; 'received:66': 0.38; 'delete': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.40; 'relationship': 0.61; 'skip:u 10': 0.61; 'header:Message-Id:1': 0.61; 'subject:more': 0.61; '30,': 0.63; 'between': 0.65; 'mar': 0.65; 'absolutely': 0.88 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=IOHa65SheUD2V5NSZ7mcChhiVjo=; b=y9ZR93 3j9NC9FubzRT71uO166Gmd02uj+LIw628Bi8KljAwWTTgAjxQkSAHqYgPoyuTb1I UNhE98w/nKDkYfD966+ilmwXskYfvlvU2/O6dZaGZD8QYuuErLbFz7WKqfs46GfA CsdPKo3neAzlJMm91NPDVV//H74BlUpx3mJIw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=IOHa65SheUD2V5N SZ7mcChhiVjo=; b=jYi1IUvIrG2/qbl4woADBfAw4gXugg48CzzT7kx4bntLz5k w6LfnBSCAhCs9MYbpE40gYr34YWCh14bQlPOKgMCN020CA52Swp3B9bpOZH9WYVX EUobkcJ3ObGltTBv4dTeeNurEbiDeRs43il9T5XvjwgGubLKT4trDkYlj7bw= X-Sasl-Enc: vhVBn0HukvYmJ8u2RKq9oXmujNDLtL8EtpHA6Fg9+ZOM 1459342222 X-Mailer: MessagingEngine.com Webmail Interface - ajax-2c910a9a In-Reply-To: <56fb677f$0$11121$c3e8da3@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 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:106060 On Wed, Mar 30, 2016, at 01:43, Steven D'Aprano wrote: > This is not an argument about dicts being mutable, because clearly they > aren't. This is an argument about key:value pairs being stable. "Stable" > doesn't mean "immutable". If you change the value associated with a key > directly, then it will change. That's the whole point. But if you change > *one* key, the relationship between *other* keys and their values > shouldn't > change. This doesn't mean that an object violates the contract by having a method that changes the relationships between multiple keys and values. I had considered including an example of replacing the _whole dictionary_ with a new object in the ellipsis. Absolutely nothing is stable under a *completely unrestricted* set of operations. > Specifically, insertions and deletions to the mapping never affect the > existing keys. You can't say that, because there is no insert and delete method in the mapping interface. > If somebody wants to insist that this is a kind of mapping, I can't > disagree, but it isn't useful as a mapping type. Javascript seems to manage it just fine.