summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-20 03:38:12 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-06-20 03:38:12 (GMT)
commit9c051d7e01af2f8072d05a0dba2d180cf989e605 (patch)
tree52705e82086d7bb850013be00b06ffeb42334b4a /Lib/calendar.py
parent9c14badc5fed3c28504470ba4bd64bf7acad599f (diff)
downloadcpython-9c051d7e01af2f8072d05a0dba2d180cf989e605.zip
cpython-9c051d7e01af2f8072d05a0dba2d180cf989e605.tar.gz
cpython-9c051d7e01af2f8072d05a0dba2d180cf989e605.tar.bz2
SF 570727 indexer() class no longer needed since lists now support slicing
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 8c81b53..b0834c9 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -9,7 +9,6 @@ set the first day of the week (0=Monday, 6=Sunday)."""
# Import functions and variables from time module
from time import localtime, mktime, strftime
-from types import SliceType
__all__ = ["error","setfirstweekday","firstweekday","isleap",
"leapdays","weekday","monthrange","monthcalendar",
@@ -31,15 +30,7 @@ mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
# that, but supply localized names. Note that the values are computed
# fresh on each call, in case the user changes locale between calls.
-class _indexer:
- def __getitem__(self, i):
- if isinstance(i, SliceType):
- return self.data[i.start : i.stop]
- else:
- # May raise an appropriate exception.
- return self.data[i]
-
-class _localized_month(_indexer):
+class _localized_month:
def __init__(self, format):
self.format = format
@@ -47,12 +38,12 @@ class _localized_month(_indexer):
self.data = [strftime(self.format, (2001, j, 1, 12, 0, 0, 1, 1, 0))
for j in range(1, 13)]
self.data.insert(0, "")
- return _indexer.__getitem__(self, i)
+ return self.data[i]
def __len__(self):
return 13
-class _localized_day(_indexer):
+class _localized_day:
def __init__(self, format):
self.format = format
@@ -60,7 +51,7 @@ class _localized_day(_indexer):
# January 1, 2001, was a Monday.
self.data = [strftime(self.format, (2001, 1, j+1, 12, 0, 0, j, j+1, 0))
for j in range(7)]
- return _indexer.__getitem__(self, i)
+ return self.data[i]
def __len__(self_):
return 7