[Python-checkins] python/nondist/sandbox/datetime datetime.c,1.29,1.30 obj_delta.c,1.8,1.9 test_both.py,1.11,1.12

Guido van Rossum guido@python.org
Mon, 02 Dec 2002 04:18:54 -0500


> PROBLEM:  Noted that timedelta comparison doesn't work as intended.  I
> assume the same is true for all comparisons defined here.  I don't know
> whether this is a bug in Python (current CVS), or a bug here, so don't
> know how to fix it.  For example, cmp(timedelta(whatever), 42) ends up
> comparing the type names of the objects, despite that timedelta's
> tp_compare function is trying its darnedest to raise TypeError then.
> Turns out the tp_compare function isn't called unless both objects are
> timedeltas.

I seem to recall that using tp_richcompare doesn't have this problem.

--Guido van Rossum (home page: http://www.python.org/~guido/)