[Python-checkins] python/dist/src/Doc/lib libdatetime.tex,1.8,1.9

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 26 Dec 2002 16:41:13 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv11885/python/Doc/lib

Modified Files:
	libdatetime.tex 
Log Message:
Make comparison and subtraction of aware objects ignore tzinfo if the
operands have identical tzinfo members (meaning object identity -- "is").
I misunderstood the intent here, reading wrong conclusion into
conflicting clues.


Index: libdatetime.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdatetime.tex,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** libdatetime.tex	25 Dec 2002 07:40:54 -0000	1.8
--- libdatetime.tex	27 Dec 2002 00:41:11 -0000	1.9
***************
*** 864,871 ****
  \begin{itemize}
    \item
!     comparison of \class{timetz} to timetz, where timetz1 is considered
!     less than timetz2 when timetz1 precedes timetz2 in time, and
!     where the \class{timetz} objects are first adjusted by subtracting
!     their UTC offsets (obtained from \method{utcoffset()}).
  
    \item
--- 864,876 ----
  \begin{itemize}
    \item
!     comparison of \class{timetz} to \class{time} or \class{timetz},
!     where \var{a} is considered less than \var{b} when \var{a} precedes
!     \var{b} in time.  If one comparand is naive and the other is aware,
!     \exception{TypeError} is raised.  If both comparands are aware, and
!     have the same \member{tzinfo} member, the common \member{tzinfo}
!     member is ignored and the base times are compared.  If both
!     comparands are aware and have different \member{tzinfo} members,
!     the comparands are first adjusted by subtracting their UTC offsets
!     (obtained from \code{self.utcoffset()}).
  
    \item
***************
*** 1012,1015 ****
--- 1017,1021 ----
      datetimetz1 + timedelta -> datetimetz2
      timedelta + datetimetz1 -> datetimetz2
+ 
      The same as addition of \class{datetime} objects, except that
      datetimetz2.tzinfo is set to datetimetz1.tzinfo.
***************
*** 1017,1020 ****
--- 1023,1027 ----
    \item
      datetimetz1 - timedelta -> datetimetz2
+ 
      The same as addition of \class{datetime} objects, except that
      datetimetz2.tzinfo is set to datetimetz1.tzinfo.
***************
*** 1026,1055 ****
      datetime1 - \naive\_datetimetz2 -> timedelta
  
!   \item
!     Subtraction of a \class{datetime} or datetimetz, from a
      \class{datetime} or \class{datetimetz}, is defined only if both
!     operands are \naive, or if both are aware.  If one is aware and
!     the other is \naive, \exception{TypeError} is raised.
  
!   \item
!     If both are \naive, subtraction acts as for \class{datetime}
!     subtraction.
  
!   \item
!     If both are aware \class{datetimetz} objects, a-b acts as if a and b were
!     first converted to UTC datetimes (by subtracting \code{a.utcoffset()}
!     minutes from a, and \code{b.utcoffset()} minutes from b), and then doing
      \class{datetime} subtraction, except that the implementation never
      overflows.
  
    \item
!     Comparison of \class{datetimetz} to \class{datetime} or datetimetz.  As for
!     subtraction, comparison is defined only if both operands are
!     \naive\ or both are aware.  If both are \naive, comparison is as
!     for \class{datetime} objects with the same date and time components.
!     If both are aware, comparison acts as if both were converted to
!     UTC datetimes first, except the the implementation never
!     overflows.  If one comparand is \naive\ and the other aware,
!     \exception{TypeError} is raised.
  
    \item
--- 1033,1061 ----
      datetime1 - \naive\_datetimetz2 -> timedelta
  
!     Subtraction of a \class{datetime} or \class{datetimetz}, from a
      \class{datetime} or \class{datetimetz}, is defined only if both
!     operands are \naive, or if both are aware.  If one is aware and the
!     other is \naive, \exception{TypeError} is raised.
  
!     If both are \naive, or both are aware and have the same \member{tzinfo}
!     member, subtraction acts as for \class{datetime} subtraction.
  
!     If both are aware and have different \member{tzinfo} members,
!     \code{a-b} acts as if \var{a} and \var{b} were first converted to UTC
!     datetimes (by subtracting \code{a.utcoffset()} minutes from \var{a},
!     and \code{b.utcoffset()} minutes from \var{b}), and then doing
      \class{datetime} subtraction, except that the implementation never
      overflows.
  
    \item
!     comparison of \class{datetimetz} to \class{datetime} or
!     \class{datetimetz}, where \var{a} is considered less than \var{b}
!     when \var{a} precedes \var{b} in time.  If one comparand is naive and
!     the other is aware, \exception{TypeError} is raised.  If both
!     comparands are aware, and have the same \member{tzinfo} member,
!     the common \member{tzinfo} member is ignored and the base datetimes
!     are compared.  If both comparands are aware and have different
!     \member{tzinfo} members, the comparands are first adjusted by
!     subtracting their UTC offsets (obtained from \code{self.utcoffset()}).
  
    \item