Path: csiph.com!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Marco Sulla Newsgroups: comp.lang.python Subject: Re: Suggestion: make sequence and map interfaces more similar Date: Thu, 31 Mar 2016 14:49:51 +0200 Lines: 29 Sender: forwardedby@e4ward.com Message-ID: References: <56f8836b$0$1602$c3e8da3$5496439d@news.astraweb.com> <56FA8C71.4050306@rece.vub.ac.be> <56fb677f$0$11121$c3e8da3@news.astraweb.com> <56fbf879$0$1591$c3e8da3$5496439d@news.astraweb.com> <56fc8f20$0$1600$c3e8da3$5496439d@news.astraweb.com> Reply-To: mail.python.org@marco.sulla.e4ward.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de FgIEmce4eDfKGsh36n6B8APCht96oISfTRfEl0b6En/A== Return-Path: <14141.gmail.com@bounce.e4ward.com> X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'sequences.': 0.07; '"if': 0.09; 'dict': 0.09; 'immutable': 0.09; 'indexes': 0.09; 'iterate': 0.09; 'rossum': 0.09; 'similar,': 0.09; 'missed': 0.15; 'argument': 0.15; '2016': 0.16; 'integers.': 0.16; 'iterated': 0.16; 'iterates': 0.16; 'iteration': 0.16; 'keys.': 0.16; 'lookups': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:interfaces': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'comparing': 0.18; 'proposed': 0.20; 'default,': 0.22; 'friend.': 0.22; 'keys': 0.22; 'lawrence': 0.22; 'suppose': 0.22; 'wrote': 0.23; 'header:In- Reply-To:1': 0.24; 'van': 0.26; 'message-id:@mail.gmail.com': 0.27; 'sequence': 0.27; 'values': 0.28; 'interface': 0.29; 'pep': 0.29; 'url:peps': 0.29; 'skip:_ 10': 0.32; 'url:python': 0.33; 'focusing': 0.33; 'previous': 0.34; 'add': 0.34; 'received:google.com': 0.35; 'header:Received:8': 0.35; 'mapping': 0.35; 'maps': 0.35; 'url:dev': 0.35; 'supports': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209': 0.38; 'thank': 0.38; 'why': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'some': 0.40; 'default': 0.61; 'subject:more': 0.61; 'more': 0.63; 'march': 0.64; 'other.': 0.64; 'between': 0.65; 'python-list': 0.66; 'said:': 0.66; 'header :Reply-To:1': 0.67; 'natural': 0.67; 'dear': 0.67; 'reply-to:no real name:2**0': 0.71; 'confirming': 0.84; 'observed': 0.84; 'received:23': 0.84; 'convinced': 0.93 Authentication-Results: dfw.e4ward.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=e4ward.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=e4ward.com; h= reply-to:content-type:content-type:subject:subject:message-id :date:date:from:from:references:in-reply-to:mime-version; s= mail; t=1459428633; x=1459515034; bh=FKB0TZMMHGOoI8m6V4kHyEtHkED 3s//yrz94hADZb/k=; b=rozMSpgQjDAZ8bstCtzId4ULtZDEFpbn1dE30awozI9 hFZZo0S1R2ykFcglyIBE90Pt2opdt4G7ABXNpv4i+/iH8XPROlptL9bVhCFn9m7T qTUYGRD+vFz/t29T3oddjUoWeot3RT7zLTNgrJKON2pqjHv7vNKMd1Mf5lY5zbXc = Authentication-Results: dfw.e4ward.com (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=FKB0TZMMHGOoI8m6V4kHyEtHkED3s//yrz94hADZb/k=; b=F5+1FAKRLDbW27X/UyZTadkkD8GUdsm7kZUXgv6wK5JIIIIYUFbj5qpo5xDA8Vw4XP NeICLiKiB8md3mlDd+pa0ub6ACsYpeLjTX5UBRKwbFM4aQ5gKwfUTOkP6kW0Xhut+Eiy hoKcYj/KCn3co630NUbhy7pDo1coIkUXvMARHsxt2s+h0FilkWQ8Mz7RvQ5jfQsvHBPx eiWZlTw7230Fhw5vy4Eg1ygKV/C/i+zY2P13Vs3pKkplC3H7Dr/dZbu4xWY8FW/hlGEc S52cTG7CGHptQ3uZr1tdQnEvwQYe/C79IEchQ+EZM3uQvKtQtKLX/jwT9s4iem8u17fE ObsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=FKB0TZMMHGOoI8m6V4kHyEtHkED3s//yrz94hADZb/k=; b=H3hHsdKMaf+Vr35Uo6sT+DHiphjxi4Jizjsa1S0B3IBFVKRc0CDFpUWdwqn8m3rdlf TdjyaN2t0W7xwTCx+WpZGzdI/hWLbwbpxuKRIsDrvt7W4duTg9HtkwqFUlj6z251uWC8 s9Ro6pcX5CC/+x31m5dg4cdxSqM1IomXfOIkY5qKk+dlJu5HkIa6wYQyJlQOlHufuhjC z8foksJzSWIKICYPk1YjoJTbY5UEzz8ZMgOzkXWZkYl3S7q/j/ZUoJzRM5ddOhqXm6bO XN1H70W8uuu5cUE6FvvoXN7wpnx2ZG3aMNiYKVRIHO4mT1am9qhZoziy4dbYzNG0WZeL f35g== X-Gm-Message-State: AD7BkJKmTuAIiSwa9LCg+mMQ78W1NGMBmojq/5MxtK2kLz02CTB6lSDmiNFFn+tCbIb+sDISivIc4Fw+naUfeg== X-Received: by 10.107.8.30 with SMTP id 30mr1875271ioi.60.1459428630814; Thu, 31 Mar 2016 05:50:30 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: VwvNEmVlrYAPjnseEvQqhoEth_s X-e4ward-RCPT: python-list.python.org-mail.python.org.marco.sulla.e4ward.com@ftcw4rx8877.reply.e4ward.com X-e4ward-x: . 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:106151 I want also to add that we are focusing on sequences, but my proposal is also to make map interface more similar, introducing a vdict type that iterates over values, and this will be for me really more practical. PEP 234 ( http://legacy.python.org/dev/peps/pep-0234/ ) never convinced me. Van Rossum said: > The symmetry between "if x in y" and "for x in y" > suggests that it should iterate over keys. This symmetry has been > observed by many independently and has even been used to "explain" > one using the other. This is because for sequences, "if x in y" > iterates over y comparing the iterated values to x. This argument will never convinced me. It's a lot more practical (as Van Rossum admitted further) to iterate over values by default on maps. Furthermore I see much more symmetry between keys of maps and indexes of sequences, so it's much more natural to make map iteration over values by default, as for sequences. This is why I proposed a vdict. On 31 March 2016 at 14:30, Mark Lawrence via Python-list wrote: > Note that dict also supports > __getitem__() and __len__(), but is considered a mapping rather than a > sequence because the lookups use arbitrary immutable keys rather than > integers. Thank you for confirming for what I already wrote and quoted, but I suppose you missed some of my previous messages, my dear friend.