Re:Python Standard Library changes in recent years
by matjet on Saturday May 21, 2022 @04:44AM
(#31456309)
I do not see the use for this, over the standard access methods.
The common usecase is:
vs
What is the advantage?
[ Parent
| on HN ]
Re:Python Standard Library changes in recent years
by ssl232 on Saturday May 21, 2022 @04:47AM
(#31456325)
It gives you access to the original dictionary from a view. I've not played with it yet but I guess that means you can modify it.
EDIT: apparently not:
>>> keys.mapping
mappingproxy({'Diane': 70, 'Bob': 78, 'Emma': 84})
In this case I actually don't know what the use case is :shrug:
Re:Python Standard Library changes in recent years
by mjw1007 on Saturday May 21, 2022 @05:14AM
(#31456435)
The rationale was here.
https://github.com/python/cpython/issues/85067#issuecomment-...
It seems a bit vague: « Exposing this attribute would help with introspection, making it possible to write efficient functions that operate on dict views. »