diff options
author | Walter Dörwald <walter@livinglogic.de> | 2006-04-03 15:20:28 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2006-04-03 15:20:28 (GMT) |
commit | aba10cf153193032a494dbd0667a1b86a32d821b (patch) | |
tree | 71b8c7a5c93c15ca46511b3a97b9f068da1497de /Lib/calendar.py | |
parent | ebed3f629b9adedddca4f0d1d3e2408ea560a06f (diff) | |
download | cpython-aba10cf153193032a494dbd0667a1b86a32d821b.zip cpython-aba10cf153193032a494dbd0667a1b86a32d821b.tar.gz cpython-aba10cf153193032a494dbd0667a1b86a32d821b.tar.bz2 |
Turn firstweekday into a property.
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r-- | Lib/calendar.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py index 1a4dbba..2b974bf 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -130,6 +130,15 @@ class Calendar(object): def __init__(self, firstweekday=0): self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday + def getfirstweekday(self): + return self._firstweekday + + def setfirstweekday(self, firstweekday): + if not MONDAY <= firstweekday <= SUNDAY: + raise IllegalWeekdayError(firstweekday) + self._firstweekday = firstweekday + firstweekday = property(getfirstweekday, setfirstweekday) + def iterweekdays(self): """ Return a iterator for one week of weekday numbers starting with the @@ -559,14 +568,8 @@ class LocaleHTMLCalendar(HTMLCalendar): # Support for old module level interface c = TextCalendar() -def firstweekday(): - return c.firstweekday - -def setfirstweekday(firstweekday): - if not MONDAY <= firstweekday <= SUNDAY: - raise IllegalWeekdayError(firstweekday) - c.firstweekday = firstweekday - +firstweekday = c.getfirstweekday +setfirstweekday = c.setfirstweekday monthcalendar = c.monthdayscalendar prweek = c.prweek week = c.formatweek |