Tal Einat <talei...@gmail.com> added the comment:

> Would it be possible to tell pickle to serialize .isocalendar() as a tuple, 
> and deserialize it from a tuple to a structseq?

The former is possible but that latter is not: If the object is pickled as a 
tuple, it will always be unpickled as a simple tuple. To customize unpickling, 
the serialized data must include the name of the class to use, and that class 
will never exist in earlier Python versions. I don't think there's a way around 
this.

However, I find Raymond's note very convincing, in that we should likely not 
let the unpickling issue get in the way of this improvement:

> FWIW, most things in Python that return a structseq previously returned a 
> tuple (for example, time.localtime() and sys.version_info).
>
> This is not an unprecedented upgrade to improve the repr and provide access 
> by field name in addition to positional access.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24416>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to