Message225188
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`. |
|
Date |
User |
Action |
Args |
2014-08-11 14:17:13 | poke | set | recipients:
+ poke |
2014-08-11 14:17:13 | poke | set | messageid: <1407766633.4.0.589829089007.issue22183@psf.upfronthosting.co.za> |
2014-08-11 14:17:13 | poke | link | issue22183 messages |
2014-08-11 14:17:13 | poke | create | |
|