datetime and the rich-companison operators

Ethan Furman ethan at stoneleaf.us
Mon Dec 8 02:41:48 EST 2008


Greetings All!

I am implementing a NullDate class in order to mirror dates and 
datetimes that have no value  (yes, this is for my dbf  module :)

I'm still a bit fuzzy about class methods, hashing, and __new__, but my 
question of the moment is this:  it seems to me that with two dates or 
datetimes, they should either be equal, or one should precede the other, 
and this can be accomplished quite handily with __cmp__... so does 
anyone know why the rich comparisons were used in the datetime module? 
Was it simply a style choice, or is something being handled that __cmp__ 
couldn't cope with?

Thanks in advance!
~ethan~



More information about the Python-list mailing list