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 12:52:16 -0400 Lines: 20 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> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de f394ODzUPPTQiUrvaqKQhgbhc3p77hrt8Mdb39gwJwlw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'iterate': 0.09; 'received:internal': 0.09; 'writable': 0.09; '__getitem__,': 0.16; 'd.items():': 0.16; 'interface"': 0.16; 'iterator': 0.16; 'java.': 0.16; 'message-id:@webmail.messagingengine.com': 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; 'stuff,': 0.16; 'subject:interfaces': 0.16; 'subject:make': 0.16; 'whatever,': 0.16; 'assign': 0.22; 'pass': 0.22; 'bit': 0.23; 'header:In-Reply-To:1': 0.24; 'discussion': 0.24; 'sequence': 0.27; 'values': 0.28; 'regardless': 0.31; 'maybe': 0.33; 'getting': 0.33; 'common': 0.33; 'c++': 0.35; 'mapping': 0.35; 'sometimes': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'being': 0.37; 'doing': 0.38; 'received:66': 0.38; 'anything': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'header:Message-Id:1': 0.61; 'subject:more': 0.61; 'request.': 0.66; 'distracted': 0.84 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=0Ixo6brdCEemWewU75EduX3IFgQ=; b=R5xctQ xg+htYjrZVW6cgpMpYNSa5cJog6HX+nr88bGoeDjQQgQERv04KLLunquL0NKhvQN qoMGNRJd165rKabaq9o8zggnFSwLmlkxav2M1ZjGV5d/zET+Fd9U6PEhpfalSF36 QeeT5ss1cItE933+F3Xc0iu73MdwaDeUS/UHM= 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=0Ixo6brdCEemWew U75EduX3IFgQ=; b=M9BMjOtQH14DS6E4c47CvKX2cNOhGAnymed/I5z8MUOIr1X v6Uh4JVcvp/lVU+904A2+3t/xyVXBPO3xWsXv3vA+Vt0ZzQRkhArmh5zzxZ7gUxK fmqvt7grgExWHAd+x20fzPhqsnkQpXeq3ecP+Qs8UZZWuuRIItQZYe0ChjFo= X-Sasl-Enc: 4ULo9rOSySyWVsRf4lmpYviMjTdHJbPX1KlD5xEeyMeF 1459356736 X-Mailer: MessagingEngine.com Webmail Interface - ajax-2c910a9a In-Reply-To: <56fbf879$0$1591$c3e8da3$5496439d@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:106095 This discussion is getting a bit distracted from the original request. Let's look at it from a higher level. What is being requested, regardless of if you call it a "map interface" or whatever, is a single way, for sequences and maps... broadly, anything with a __getitem__, to iterate over all values which one might pass to __getitem__, so that one might (among other things) call __setitem__ to mutate the collection. Like, these are common patterns: for i, x in enumerate(l): # do some stuff, sometimes assign l[i] for k, v in d.items(): # do some stuff, sometimes assign d[k] A way to apply that pattern generically to an object which may be either a sequence or a mapping might be nice. Or some other way of doing this operation - maybe a writable iterator like C++ or Java.