[issue5094] datetime lacks concrete tzinfo impl. for UTC

Alexander Belopolsky report at bugs.python.org
Wed Jun 2 22:49:53 CEST 2010

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

Here is my first attempt to implement fixed offset timezone type.  The patch is based on Brett's next-patch.txt and while I changed the type name from datetime.UTC to datetime.timezone, I did not change the name of the related C structures.  I would like to ask for comments on the following questions:

1. How to call the new type?  I like "timezone" because it is likely to be the only concrete tzinfo subclass in datetime module, so we don't really need to call it fixedoffsetfromutctimezone.

2. Do we want to add a dst indicator and altname attributes? I would say: no. I would rather treat DST as a different fixed offset timezone.

3. I am not quite happy about having to specify offset in minutes.  I think timezone(hours[, minutes]) may be clearer.  Alternatively we may just take offset as a timedelta.  Note issue5288.  There is some interest in supporting sub-minute timezones.

4. I have fixed a reference leak in utcnow, but I am still against giving it tz_aware argument.

Added file: http://bugs.python.org/file17525/issue5094.diff

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list