[Python-checkins] r82454 - sandbox/branches/py3k-datetime/datetime.py
alexander.belopolsky
python-checkins at python.org
Fri Jul 2 23:25:47 CEST 2010
Author: alexander.belopolsky
Date: Fri Jul 2 23:25:47 2010
New Revision: 82454
Log:
Cleaned up some XXXs
Modified:
sandbox/branches/py3k-datetime/datetime.py
Modified: sandbox/branches/py3k-datetime/datetime.py
==============================================================================
--- sandbox/branches/py3k-datetime/datetime.py (original)
+++ sandbox/branches/py3k-datetime/datetime.py Fri Jul 2 23:25:47 2010
@@ -319,7 +319,6 @@
__slots__ = '__days', '__seconds', '__microseconds'
def __new__(cls, days=0, seconds=0, microseconds=0,
- # XXX The following should only be used as keyword args:
milliseconds=0, minutes=0, hours=0, weeks=0):
# Doing this efficiently and accurately in C is going to be difficult
# and error-prone, due to ubiquitous overflow possibilities, and that
@@ -329,7 +328,7 @@
# guide the C implementation; it's way more convoluted than speed-
# ignoring auto-overflow-to-long idiomatic Python could be.
- # XXX Check that all inputs are ints, longs or floats.
+ # XXX Check that all inputs are ints or floats.
# Final values, all integer.
# s and us fit in 32-bit signed ints; d isn't bounded.
@@ -839,8 +838,7 @@
if 0 < o <= _MAXORDINAL:
return date.fromordinal(o)
raise OverflowError("result out of range")
- raise TypeError
- # XXX Should be 'return NotImplemented', but there's a bug in 2.2...
+ return NotImplemented
__radd__ = __add__
@@ -1112,7 +1110,6 @@
(other.__hour, other.__minute, other.__second,
other.__microsecond))
if myoff is None or otoff is None:
- # XXX Buggy in 2.2.2.
raise TypeError("cannot compare naive and aware times")
myhhmm = self.__hour * 60 + self.__minute - myoff
othhmm = other.__hour * 60 + other.__minute - otoff
@@ -1287,9 +1284,11 @@
time.resolution = timedelta(microseconds=1)
class datetime(date):
+ """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
- # XXX needs docstrings
- # See http://www.zope.org/Members/fdrake/DateTimeWiki/TimeZoneInfo
+ The year, month and day arguments are required. tzinfo may be None, or an
+ instance of a tzinfo subclass. The remaining arguments may be ints or longs.
+ """
__slots__ = date.__slots__ + (
'__hour', '__minute', '__second',
@@ -1667,7 +1666,6 @@
other.__hour, other.__minute, other.__second,
other.__microsecond))
if myoff is None or otoff is None:
- # XXX Buggy in 2.2.2.
raise TypeError("cannot compare naive and aware datetimes")
# XXX What follows could be done more efficiently...
diff = self - other # this will take offsets into account
More information about the Python-checkins
mailing list