[Python-checkins] CVS: python/nondist/sandbox/datetime datetime.py,1.2,1.3

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 01 Mar 2002 14:19:43 -0800


Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory usw-pr-cvs1:/tmp/cvs-serv28789

Modified Files:
	datetime.py 
Log Message:
__cmp__ must raise an error when other isn't a datetime, otherwise the
default (meaningless) comparison will be used.


Index: datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** datetime.py	1 Mar 2002 21:40:28 -0000	1.2
--- datetime.py	1 Mar 2002 22:19:41 -0000	1.3
***************
*** 139,143 ****
                  return cmp(self._timestamp(), other._timestamp())
          else:
!             return NotImplemented
  
      def __hash__(self):
--- 139,144 ----
                  return cmp(self._timestamp(), other._timestamp())
          else:
!             raise TypeError, ("can't compare datetime to %s instance" %
!                               type(other).__name__)
  
      def __hash__(self):