comparing DateTime instances
marklists at mceahern.com
Fri Feb 1 18:48:27 EST 2002
Steve Holden wrote:
> It is indeed telling you the DateTime values are equal. Did you think of
> trying the equality operator?
Yeah, I did, but it was failing because of rounding errors. That's why I
felt I had to resort to cmp, since it allows an optional accuracy parameter.
I just got all flummoxed because my brain wanted it to return true for
equality. This is despite the fact that I've defined __cmp__ for my own
classes in the past and been bitten by the same confusion. I guess my brain
just doesn't work that way.
> [...]I suspect you are going to enjoy Python.
That's true, I enjoy it immensely. Thanks for the helpful explanation.
More information about the Python-list