(cls, year, month=None, day=None)
return self
Constructor.

        Arguments:

        year, month, day (required, base 1)
Constructor.
Constructor .
def __new__(cls, year, month=None, day=None):
        """Constructor.

        Arguments:

        year, month, day (required, base 1)
        """
        if (month is None and
            isinstance(year, (bytes, str)) and len(year) == 4 and
            1 <= ord(year[2:3]) <= 12):
            # Pickle support
            if isinstance(year, str):
                try:
                    year = year.encode('latin1')
                except UnicodeEncodeError:
                    # More informative error message.
                    raise ValueError(
                        "Failed to encode latin1 string when unpickling "
                        "a date object. "
                        "pickle.load(data, encoding='latin1') is assumed.")
            self = object.__new__(cls)
            self.__setstate(year)
            self._hashcode = -1
            return self
        year, month, day = _check_date_fields(year, month, day)
        self = object.__new__(cls)
        self._year = year
        self._month = month
        self._day = day
        self._hashcode = -1
        return self
def __new__ ( cls , year , month = None , day = None ) : if ( month is None and isinstance ( year , ( bytes , str ) ) and len ( year ) == 4 and 1 <= ord ( year [ 2 : 3 ] ) <= 12 ) : # Pickle support if isinstance ( year , str ) : try : year = year . encode ( 'latin1' ) except UnicodeEncodeError : # More informative error message. raise ValueError ( "Failed to encode latin1 string when unpickling " "a date object. " "pickle.load(data, encoding='latin1') is assumed." ) self = object . __new__ ( cls ) self . __setstate ( year ) self . _hashcode = - 1 return self year , month , day = _check_date_fields ( year , month , day ) self = object . __new__ ( cls ) self . _year = year self . _month = month self . _day = day self . _hashcode = - 1 return self