comparing DateTime instances

David Bolen db3l at fitlinxx.com
Fri Feb 1 20:32:22 EST 2002


"Mark McEahern" <mark at mceahern.com> writes:

> The documentation for mx.DateTime's cmp seems to assume the reader
> understands __cmp__.  This is all we find there:
> 
> "cmp(obj1,obj2,accuracy=0.0)
> Compares two DateTime[Delta] objects.
> If accuracy is given, then equality will result in case the absolute
> difference between the two values is less than or equal to accuracy."

I think the documentation more assumes that the reader is familiar
with the builtin cmp() function (and not necessarily the __cmp__
method, although the former is really just direct access to the
latter), which seems fairly reasonable to me.  And the documentation
for cmp() does detail the <0, 0, >0 result code of the function.

But adding some qualification (even if only to note it mirrors cmp())
certainly doesn't seem a bad thing.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list