Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rejected': 0.09; 'slices': 0.09; 'subject:()': 0.09; 'python': 0.11; 'jan': 0.12; 'assume': 0.14; 'changes': 0.15; 'nope,': 0.16; 'read- only.': 0.16; 'read-write': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'underlying': 0.16; 'wrote:': 0.18; 'proposed': 0.22; 'header:User-Agent:1': 0.23; 'instance,': 0.24; 'define': 0.26; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'generally': 0.29; '3.x': 0.31; 'text': 0.33; 'copying': 0.34; 'updated': 0.34; 'sense': 0.34; 'but': 0.35; 'opposed': 0.36; 'view,': 0.36; 'should': 0.36; 'being': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'new': 0.61; 'received:173': 0.61; 'show': 0.63; 'believe': 0.68; 'subject: & ': 0.68; "'view'": 0.84; 'ethan': 0.84; 'furman': 0.84; 'received:fios.verizon.net': 0.84; 'lists:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Python 3: dict & dict.keys() Date: Thu, 25 Jul 2013 14:37:14 -0400 References: <51EF2AD8.3080105@stoneleaf.us> <51F01D9E.2030903@stoneleaf.us> <5B80DD153D7D744689F57F4FB69AF474185C131B@SCACMX008.exchad.jpmchase.net> <5B80DD153D7D744689F57F4FB69AF474185CA82D@SCACMX008.exchad.jpmchase.net> <51F1506E.2020800@stoneleaf.us> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 In-Reply-To: <51F1506E.2020800@stoneleaf.us> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374777455 news.xs4all.nl 15902 [2001:888:2000:d::a6]:33862 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51252 On 7/25/2013 12:21 PM, Ethan Furman wrote: > On 07/25/2013 09:11 AM, Prasad, Ramit wrote: >> Hmm, that is a change that makes some sense to me. Does the view >> get updated when dictionary changes or is a new view needed? I >> assume the latter. > > Nope, the former. That is a big advantage that the views have over > concrete lists: they show the /current/ state, and so are always > up-do-date. I think 'view' is generally used in CS to mean a live view, as opposed to a snapshot. Memoryviews in 3.x are also live views. Dictionary views are read-only. I believe memoryviews can be read-write if allowed by the object being viewed. Python slices are snapshots. It has been proposed that they should be views to avoid copying memory, but that has been rejected since views necessarily keep the underlying object alive. Instead, applications can define the views they need. (They might, for instance, allow multiple slices in a view, as tk Text widgets do.) -- Terry Jan Reedy