[issue42070] I think the rationale to keep IsoCalendarDate private from the pickle perspective should get revisited

Paul Ganssle report at bugs.python.org
Sun Oct 18 16:53:38 EDT 2020


Paul Ganssle <p.ganssle at gmail.com> added the comment:

That's a reasonable enough objection, though what use case do you have for storing the IsocalendarDate object? The main reason we switched to using a named tuple like this was because the vast majority of uses of `isocalendar()` that I saw were people doing stuff like `dt.isocalendar()[0]`, rather than destructuring the tuple or accessing more than one element from the result.

It seems to me that if you are using a pickle for a cache, you'd either pickle the `datetime` itself (and call `.isocalendar()` in the process that has read from the cache already), or you'd store one or more of the fields directly on the object that you are caching.

A real life use case for this would help.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42070>
_______________________________________


More information about the Python-bugs-list mailing list