Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64331
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: Documentation of dict views change request |
| Date | 2014-01-19 18:22 -0500 |
| References | <52DC42EB.2010707@earthlink.net> <lbhgpv$ibh$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5731.1390173741.18130.python-list@python.org> (permalink) |
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 of >> access rather than directly through the returned values.) >> >> P.S.: Is it reasonable to return the items() of a dict in order to pass >> 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¶ The objects returned by dict.keys(), dict.values() and dict.items() are view objects. The 'view object' are implicitly 'read-only' because no syntax is given to write to them, but ahead and propose adding 'read-only' to make the above explicitly say "read-only view objects". -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Documentation of dict views change request Terry Reedy <tjreedy@udel.edu> - 2014-01-19 18:22 -0500
csiph-web