Serhiy Storchaka added the comment:
Because I can! I just want to ensure that all basic types (for which it makes
sense) are correctly and portable pickleable, especially collections and
related classes. Note that currently Mapping views are pickleable (as most pure
Python classes), but pickle exposes implementation detail (the _mapping
attribute). For example pickled keys view of Python implementation of
OrderedDict is not fully compatible with C implementation. I want to provide
implementation agnostic and more efficient pickling.
>>> keys = collections.abc.KeysView({1: 2, 3: 4})
>>> keys.__reduce_ex__(3)
(<function __newobj__ at 0xb6f64bb4>, (<class 'collections.abc.KeysView'>,),
(None, {'_mapping': {1: 2, 3: 4}}), None, None)
There are many ways to do this (msg235477, msg235493). I hesitate with choosing,
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23401>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com