Author taleinat
Recipients belopolsky, berker.peksag, bmispelon, corona10, p-ganssle, rhettinger, serhiy.storchaka, taleinat, tim.peters, vstinner
Date 2019-09-05.06:00:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1567663206.35.0.112372572106.issue24416@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2019-09-05 06:00:06taleinatsetrecipients: + taleinat, tim.peters, rhettinger, belopolsky, vstinner, berker.peksag, serhiy.storchaka, bmispelon, p-ganssle, corona10
2019-09-05 06:00:06taleinatsetmessageid: <1567663206.35.0.112372572106.issue24416@roundup.psfhosted.org>
2019-09-05 06:00:06taleinatlinkissue24416 messages
2019-09-05 06:00:05taleinatcreate