[Datetime-SIG] PEP 495 (Local Time Disambiguation) is ready for pronouncement
Tim Peters
tim.peters at gmail.com
Sun Aug 16 22:10:23 CEST 2015
[Guido]
> ...
> - "We chose the minute byte to store the the "first" bit because this choice
> preserves the natural ordering." This only works with folds of exactly one
> hour. Also, is the natural ordering (of the pickles, apparently) used
> anywhere? I would hope not. Finally, given that two times that differ only
> in their 'first' flag compare equal, the natural ordering (if relevant :-)
> would be to store/compare the 'first' bit last.
I don't know of any place comparing pickles. The in-memory
representations are compared as bytestrings, e.g., like this in
datetime_richcompare:
if (GET_DT_TZINFO(self) == GET_DT_TZINFO(other)) {
diff = memcmp(((PyDateTime_DateTime *)self)->data,
((PyDateTime_DateTime *)other)->data,
_PyDateTime_DATETIME_DATASIZE);
return diff_to_bool(diff, op);
But, presumably, unpickling will move `first` out of whichever member
it's abusing in the pickle into its own byte. There are lots of
always-0-now bits in the pickle format, and I expect it doesn't matter
to anything which of those bits is abused.
More information about the Datetime-SIG
mailing list