[issue5094] datetime lacks concrete tzinfo impl. for UTC

Antoine Pitrou report at bugs.python.org
Tue May 25 11:45:22 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> Note that I am not suggesting passing anything to utcnow().  I would
> either leave it unchanged or make it always return aware datetime
> instances.

The latter would break compatibility, though (especially given how
comparison between "naive" and "aware" datetimes raises an error...).

I also agree with Brett that a singleton looks rather unnecessary (it
also look quite C++/Java-esque to me).

On the subject of the patch:
- Alexander spotted the PyObject_IsTrue() issue
- you should never use tabs (anymore), only 4 spaces
- lines like:
    self.assertTrue(isinstance(now.tzinfo, UTC))
can be rewritten as
    self.assertIsInstance(now.tzinfo, UTC)
- here, I'm not sure why you're using "UTC" as the error message
(copy/paste error?):
    self.assertEquals(None, meth(False).tzinfo, UTC)
- you might make the UTC class subclassable, although I'm not sure
there's any point

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5094>
_______________________________________


More information about the Python-bugs-list mailing list