[Python-checkins] python/nondist/sandbox/datetime
obj_delta.c,1.14,1.15 test_both.py,1.15,1.16
Tim Peters
tim.one@comcast.net
2002年12月02日 16:29:14 -0500
> I must point out that Jeremy & Barry just groaned when they saw that,
> but I figure avoiding an extra error check is worth it.
I added sufficient comments to shush their wails of anguish.
I'd rather find a way to avoid __reduce__ entirely, though! The Python
implementation of these things didn't need it, and in the date and datetime
cases it's creating bigger pickles than it should -- __getstate__ and
__setstate__ already did all that was necessary, and no more than that.
Supplying an argument tuple for __reduce__'s benefit loses either way: I
either put the real date/datetime arguments there, but then the pickle is of
a big tuple rather than of a tiny string. Or I put a dummy argument tuple
there and also include the tiny string for __setstate__, but these
constructors require at least 3 arguments so that the "dummy argument tuple"
consumes substantial space of its own.
So, as it stands, ignoring the new-style-class administrative pickle bloat
in the Python implementation, the *guts* of the pickles produced by the
Python implementation are substantially smaller than those produced by the C
implementation.