Hello all!

There is a class Calendar in calendar.py in standard libriary.


class Calendar(object):
        """
        Base calendar class. This class doesn't do any formatting. It simply
        provides data to subclasses.
        """

        def __init__(self, firstweekday=0):
        self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday

        def getfirstweekday(self):
        return self._firstweekday % 7

        def setfirstweekday(self, firstweekday):
        self._firstweekday = firstweekday

        firstweekday = property(getfirstweekday, setfirstweekday)


As far as I understand, even if user enters inappropriate firstweekday 
parameter (bigger than 6) during instansiation of the Calendar, the Calendar 
swallows it (and latter returns correct firstweekday value due to %7 in 
getfirstweekday method).


So, the question is why not explicitly raise ValueError if user enters the 
firstweekday parameter bigger that 6 (with accordance with the Zen). Am I 
missing something?


Thank you in advance


Best regards, Aynur



С уважением, А.И. Зулькарнаев

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to