[issue5094] datetime lacks concrete tzinfo impl. for UTC

Alexander Belopolsky report at bugs.python.org
Tue May 25 23:14:53 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Mon, May 24, 2010 at 11:06 PM, Rafe Kaplan <report at bugs.python.org> wrote:
..
> I had originally thought of doing the class, and then having constants associated with it:
>
>  UTC.UTC0
>
> Eventually if we support multiple timezones:
>
>  UTC.UTC1
..
>
> Well... maybe not given how impossible the naming would be.
..

I actually like your original idea.  It seems wasteful to create a
concrete timezone class in a C module and only use it for a single
timezone.  FixedOffset class in tzinfo-examples.py is only slightly
more complicated than UTC class and as explained in the comment above
it, "FixedOffset(0, "UTC") is a different way to build a UTC tzinfo
object.  FixedOffset objects can then be used to produce aware
datetime instances from strptime.  (See issue6641.)  I would only
define utc = FixedOffset(0, "UTC") instance and make name argument to
FixedOffset optional defaulting to UTC(+/-)hhmm.

----------

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


More information about the Python-bugs-list mailing list