[Datetime-SIG] Is EDT a timezone? Was: PEP-0500

Guido van Rossum guido at python.org
Sun Aug 23 00:11:16 CEST 2015


On Sat, Aug 22, 2015 at 2:53 PM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:

> Some people on this list claimed that the following behavior is a bug:
>
> >>> (t + timedelta(100)).strftime('%F %T %Z%z')
> '2015-11-30 17:45:51 EDT-0400'
>
> because the correct result should be '2015-11-30 16:45:51 EST-0500'.
>
> My answer to that is that if you need that result, you can get it, but you
> have to ask for it explicitly:
>
> >>> (t + timedelta(100)).astimezone().strftime('%F %T %Z%z')
> '2015-11-30 16:45:51 EST-0500'
>
> I don't think we can do much here other than to educate Python users.
>

It is disappointing that you still believe this, because the intention of
introducing DST-aware tzinfo objects was to be able to get the latter
answer. The trick that pytz uses to obtain timeline arithmetic causes it to
use only fixed-offset tzinfo objects. It's true that some platforms may not
give enough information about the local timezone to do better -- but others
do. There is no requirement that tzname is unique to determine all the
properties of a timezone.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150822/e9e51cec/attachment-0001.html>


More information about the Datetime-SIG mailing list