Message 109058 - Python tracker (original) (raw)
In any case, my threshold for moving this forward is for someone to review the code in sandbox.
Ok some comments:
I find the _cmp() and __cmp() indirection poor style in 3.x, especially when you simply end up comparing self._getstate() and other._getstate() (it is also suboptimal because it can do more comparisons than needed)
Shouldn't eq and friends return NotImplemented if the other type mismatches, to give the other class a chance to implement its own comparison method? that's what built-in types do, as least (this would also make _cmperror useless)
Using assert to check arguments is bad. Either there's a risk of bad input, and you should raise a proper error (for example ValueError), or there is none and the assert can be left out.
Starting _DAYS_IN_MONTH with a None element and then iterating over _DAYS_IN_MONTH[1:] looks quirky
Using double-underscored names such as __day is generally discouraged, simple-underscored names (e.g. _day) should be preferred
Some comments about "CPython compatibility" should be removed
Some other comments should be reconsidered or removed, such as "# XXX The following should only be used as keyword args" or "XXX Buggy in 2.2.2"
Some things are inconsistent: date uses bytes for pickle support, time uses str for the same purpose