[issue23401] Add pickle support of Mapping views

Guido van Rossum report at bugs.python.org
Sun Jun 5 01:12:54 EDT 2016


Guido van Rossum added the comment:

I find it extremely suspicious that if you pickle the keys of a large object it also pickles that object. These are views, not copied data, for a reason. I also take back that this is okay for concrete dict.

As for your reason (http://bugs.python.org/issue23401#msg267317), that doesn't explain the use case for pickling keys views. If you forbade pickling them would any user code break? I seriously doubt it. Who on earth would want to pickle a keys view on an OrderedDict? It doesn't contain any information other than the underlying object. These views exist as alternate APIs to dicts, not as objects by themselves.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23401>
_______________________________________


More information about the Python-bugs-list mailing list