Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'explicitly': 0.05; 'true,': 0.05; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'charles': 0.16; 'dict': 0.16; 'dynamic,': 0.16; 'objects.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'values?': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'subject:request': 0.19; 'header:User-Agent:1': 0.23; 'documented': 0.24; 'propose': 0.24; 'pass': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'url:bugs': 0.29; 'raise': 0.29; 'returned': 0.30; 'such.': 0.31; 'url:python': 0.33; 'could': 0.34; 'agree': 0.35; 'objects': 0.35; 'but': 0.35; 'url:org': 0.36; 'should': 0.36; 'changing': 0.37; '(i.e.,': 0.38; 'ahead': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'read': 0.60; 'received:173': 0.61; 'talking': 0.65; 'here': 0.66; 'confusing': 0.84; 'p.s.:': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Documentation of dict views change request Date: Sun, 19 Jan 2014 18:22:07 -0500 References: <52DC42EB.2010707@earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1390173741 news.xs4all.nl 2856 [2001:888:2000:d::a6]:55004 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:64331 On 1/19/2014 4:41 PM, Mark Lawrence wrote: > On 19/01/2014 21:26, Charles Hixson wrote: >> Could it please be clearly documented that keys(), values(), and items= () >> are not writeable. I agree that this is how they should be, but it >> would be still better if they were clearly documented as such. The >> labeling of them as dynamic, while true, was a bit confusing here. >> (I.e., it was talking about changing their value through other means o= f >> access rather than directly through the returned values.) >> >> P.S.: Is it reasonable to return the items() of a dict in order to pa= ss >> a read only copy of the values? >> > > Just raise an issue here http://bugs.python.org/ The relevant section is 4.10.1. Dictionary view objects=C2=B6 The objects returned by dict.keys(), dict.values() and dict.items() are=20 view objects. The 'view object' are implicitly 'read-only' because no syntax is given=20 to write to them, but ahead and propose adding 'read-only' to make the=20 above explicitly say "read-only view objects". --=20 Terry Jan Reedy