[Python-checkins] python/nondist/sandbox/datetime datetime.py,1.76,1.77

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 05 Dec 2002 09:14:54 -0800


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

Modified Files:
	datetime.py 
Log Message:
Removed the date.timedelta_class class attribute.  If somebody really
wanted this, they should have done at least one of {document it, test it,
put it in the C implementation too}.


Index: datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** datetime.py	5 Dec 2002 17:07:20 -0000	1.76
--- datetime.py	5 Dec 2002 17:14:52 -0000	1.77
***************
*** 636,645 ****
      __radd__ = __add__
  
-     # XXX What is timedelta_class for?  If a subclass wants to redefine
-     # XXX subtraction, it should redefine subtraction.
-     # XXX The C implementation has nothing like this, and there's
-     # XXX no test for it.
-     timedelta_class = timedelta # Allows a subclass to override
- 
      def __sub__(self, other):
          """Subtract two dates, or a date and a timedelta."""
--- 636,639 ----
***************
*** 649,653 ****
              days1 = self.toordinal()
              days2 = other.toordinal()
!             return self.timedelta_class(days1 - days2)
          return NotImplemented
  
--- 643,647 ----
              days1 = self.toordinal()
              days2 = other.toordinal()
!             return timedelta(days1 - days2)
          return NotImplemented
  
***************
*** 1220,1227 ****
                       (other.__minute) * 60 +
                       other.__hour * 3600)
!             return self.timedelta_class(
!                 days1 - days2,
!                 secs1 - secs2,
!                 self.__microsecond - other.__microsecond)
          return NotImplemented
  
--- 1214,1220 ----
                       (other.__minute) * 60 +
                       other.__hour * 3600)
!             return timedelta(days1 - days2,
!                              secs1 - secs2,
!                              self.__microsecond - other.__microsecond)
          return NotImplemented