[Datetime-SIG] PEP-431/495

Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Aug 27 17:00:12 CEST 2015

On Thu, Aug 27, 2015 at 10:38 AM, Akira Li <4kir4.1i at gmail.com> wrote:

> An *observation*: the local timezone -- the only timezone with a variable
> utc offset in _stdlib -- behaves like pytz_:
>   # start with the same utc time
>   utc_time = datetime(2015, 10, 25, 1, tzinfo=timezone.utc)
>   stdlib_time = utc_time.astimezone() # stdlib local time
>   pytz_time = utc_time.astimezone(tzlocal.get_localzone())

I have no idea where you get tzlocal from, but I can assure you that there
is no such thing in the standard library.

What we do have is an option to call .astimezone() without a tzinfo
argument and get an aware datetime instance with tzinfo set to a fixed
offset timezone.  In this respect, .astimezone() is indeed similar to
pytz's localize()/normalize(), but it is much simpler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150827/36e74e18/attachment.html>

More information about the Datetime-SIG mailing list