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
--
https://mail.python.org/mailman/listinfo/python-list