This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author poke
Recipients poke
Date 2014-08-11.14:17:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1407766633.4.0.589829089007.issue22183@psf.upfronthosting.co.za>
In-reply-to
Content
I’ve noticed that the methods in `datetime.timezone` all require a datetime object (or explicitely `None`) as its parameter or they will raise an exception.

The datetime object however is never required for the implementation of the method, so it seems to me like an unnecessary requirement, given that timezone objects are completely independent of datetime objects.

For example `timezone.utcoffset` is implemented like this:

    def utcoffset(self, dt):
        if isinstance(dt, datetime) or dt is None:
            return self._offset
        raise TypeError("utcoffset() argument must be a datetime instance"
                        " or None")

I don’t really understand this requirement and if there isn’t an actual reason for it (if there is, it should be documented somewhere), I’d suggest to remove this requirement completely. For backwards compatibility, the parameter could simply default to `None`.
History
Date User Action Args
2014-08-11 14:17:13pokesetrecipients: + poke
2014-08-11 14:17:13pokesetmessageid: <1407766633.4.0.589829089007.issue22183@psf.upfronthosting.co.za>
2014-08-11 14:17:13pokelinkissue22183 messages
2014-08-11 14:17:13pokecreate