diff options
author | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-07 22:24:25 +0000 |
commit | cfc9cc53f107f887e5bc39a57e3178486ce0b518 (patch) | |
tree | d79683480656ce97c52a0c292bd77600899dd9bc /Lib/calendar.py | |
parent | 0e5ae1325b6c4f00bebb748ab50f380b18da7151 (diff) | |
download | cpython-cfc9cc53f107f887e5bc39a57e3178486ce0b518.tar.gz |
Merged revisions 55007-55179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r55077 | guido.van.rossum | 2007-05-02 11:54:37 -0700 (Wed, 02 May 2007) | 2 lines
Use the new print syntax, at least.
........
r55142 | fred.drake | 2007-05-04 21:27:30 -0700 (Fri, 04 May 2007) | 1 line
remove old cruftiness
........
r55143 | fred.drake | 2007-05-04 21:52:16 -0700 (Fri, 04 May 2007) | 1 line
make this work with the new Python
........
r55162 | neal.norwitz | 2007-05-06 22:29:18 -0700 (Sun, 06 May 2007) | 1 line
Get asdl code gen working with Python 2.3. Should continue to work with 3.0
........
r55164 | neal.norwitz | 2007-05-07 00:00:38 -0700 (Mon, 07 May 2007) | 1 line
Verify checkins to p3yk (sic) branch go to 3000 list.
........
r55166 | neal.norwitz | 2007-05-07 00:12:35 -0700 (Mon, 07 May 2007) | 1 line
Fix this test so it runs again by importing warnings_test properly.
........
r55167 | neal.norwitz | 2007-05-07 01:03:22 -0700 (Mon, 07 May 2007) | 8 lines
So long xrange. range() now supports values that are outside
-sys.maxint to sys.maxint. floats raise a TypeError.
This has been sitting for a long time. It probably has some problems and
needs cleanup. Objects/rangeobject.c now uses 4-space indents since
it is almost completely new.
........
r55171 | guido.van.rossum | 2007-05-07 10:21:26 -0700 (Mon, 07 May 2007) | 4 lines
Fix two tests that were previously depending on significant spaces
at the end of a line (and before that on Python 2.x print behavior
that has no exact equivalent in 3.0).
........
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r-- | Lib/calendar.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py index 149c7adadb..e243255b67 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -45,7 +45,7 @@ mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] class _localized_month: - _months = [datetime.date(2001, i+1, 1).strftime for i in xrange(12)] + _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)] _months.insert(0, lambda x: "") def __init__(self, format): @@ -65,7 +65,7 @@ class _localized_month: class _localized_day: # January 1, 2001, was a Monday. - _days = [datetime.date(2001, 1, i+1).strftime for i in xrange(7)] + _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)] def __init__(self, format): self.format = format @@ -144,7 +144,7 @@ class Calendar(object): Return a iterator for one week of weekday numbers starting with the configured first one. """ - for i in xrange(self.firstweekday, self.firstweekday + 7): + for i in range(self.firstweekday, self.firstweekday + 7): yield i%7 def itermonthdates(self, year, month): @@ -192,7 +192,7 @@ class Calendar(object): Each row represents a week; week entries are datetime.date values. """ dates = list(self.itermonthdates(year, month)) - return [ dates[i:i+7] for i in xrange(0, len(dates), 7) ] + return [ dates[i:i+7] for i in range(0, len(dates), 7) ] def monthdays2calendar(self, year, month): """ @@ -202,7 +202,7 @@ class Calendar(object): are zero. """ days = list(self.itermonthdays2(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def monthdayscalendar(self, year, month): """ @@ -210,7 +210,7 @@ class Calendar(object): Each row represents a week; days outside this month are zero. """ days = list(self.itermonthdays(year, month)) - return [ days[i:i+7] for i in xrange(0, len(days), 7) ] + return [ days[i:i+7] for i in range(0, len(days), 7) ] def yeardatescalendar(self, year, width=3): """ @@ -221,9 +221,9 @@ class Calendar(object): """ months = [ self.monthdatescalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardays2calendar(self, year, width=3): """ @@ -234,9 +234,9 @@ class Calendar(object): """ months = [ self.monthdays2calendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] def yeardayscalendar(self, year, width=3): """ @@ -246,9 +246,9 @@ class Calendar(object): """ months = [ self.monthdayscalendar(year, i) - for i in xrange(January, January+12) + for i in range(January, January+12) ] - return [months[i:i+width] for i in xrange(0, len(months), width) ] + return [months[i:i+width] for i in range(0, len(months), width) ] class TextCalendar(Calendar): @@ -341,7 +341,7 @@ class TextCalendar(Calendar): header = self.formatweekheader(w) for (i, row) in enumerate(self.yeardays2calendar(theyear, m)): # months in this row - months = xrange(m*i+1, min(m*(i+1)+1, 13)) + months = range(m*i+1, min(m*(i+1)+1, 13)) a('\n'*l) names = (self.formatmonthname(theyear, k, colwidth, False) for k in months) @@ -352,7 +352,7 @@ class TextCalendar(Calendar): a('\n'*l) # max number of weeks for this row height = max(len(cal) for cal in row) - for j in xrange(height): + for j in range(height): weeks = [] for cal in row: if j >= len(cal): @@ -444,9 +444,9 @@ class HTMLCalendar(Calendar): a('<table border="0" cellpadding="0" cellspacing="0" class="year">') a('\n') a('<tr><th colspan="%d" class="year">%s</th></tr>' % (width, theyear)) - for i in xrange(January, January+12, width): + for i in range(January, January+12, width): # months in this row - months = xrange(i, min(i+width, 13)) + months = range(i, min(i+width, 13)) a('<tr>') for m in months: a('<td>') |