[issue40890] Dict views should be introspectable
Dennis Sweeney
report at bugs.python.org
Mon Jun 8 20:36:03 EDT 2020
Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:
PR 20749 gives each dict view access to a mappingproxy for the original dict, although I don't know if that defeats the original purpose.
It might be hard to sensibly make MappingProxy(d).items() return something other than d.items(), since this is already the behavior for user-defined classes:
>>> class A:
def __getitem__(self, key):
return "value"
def items(self):
return 17
>>> from types import MappingProxyType
>>> MappingProxyType(A()).items()
17
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40890>
_______________________________________
More information about the Python-bugs-list
mailing list