[Python-checkins] CVS: python/nondist/sandbox/datetime datetime.py,1.18,1.19

Tim Peters tim_one@users.sourceforge.net
Sat, 02 Mar 2002 19:58:14 -0800


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

Modified Files:
	datetime.py 
Log Message:
toordinal():  Made more efficient by referencing fields directly
instead of going thru the properties.

weekday():  Recorded disagreement in a XXX block.


Index: datetime.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** datetime.py	3 Mar 2002 03:21:45 -0000	1.18
--- datetime.py	3 Mar 2002 03:58:12 -0000	1.19
***************
*** 424,428 ****
          contribute to the result.
          """
!         return _ymd2ord(self.year, self.month, self.day)
  
      def __cmp__(self, other):
--- 424,428 ----
          contribute to the result.
          """
!         return _ymd2ord(self.__year, self.__month, self.__day)
  
      def __cmp__(self, other):
***************
*** 560,563 ****
--- 560,567 ----
          "Return day of the week, where Monday == 0 (according to ISO)."
          # The constant 6 was obtained experimentally :-)
+         # XXX I (tim) believe this is incorrect:  ISO defines day ordinals
+         # XXX as ranging from 1 (Monday) through 7 (Sunday).  The next line
+         # XXX (commented out) implements that:
+         # return self.toordinal() % 7 or 7
          return (_ymd2ord(self.__year, self.__month, self.__day) + 6) % 7