<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Sep 12, 2015 at 2:24 PM, Alexander Belopolsky <span dir="ltr"><<a href="mailto:alexander.belopolsky@gmail.com" target="_blank">alexander.belopolsky@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Sat, Sep 12, 2015 at 4:10 PM, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow:hidden">"A potential problem" with .astimezone()'s default is that it _does_<br>
create a fixed-offset zone.  It's not at all obvious that it should do<br>
so.  First time I saw it, my initial _expectation_ was that it<br>
"obviously" created a hybrid tzinfo reflecting the system zone's<br>
actual daylight rules, as various "tzlocal" implementations outside of<br>
Python do.</div></blockquote></div><br></span>The clue should have been that  .astimezone() is an instance method and you don't need to know time to create a hybrid tzinfo.  If a Local tzinfo was available, it could just be passed to the .astimezone() method as an argument.  You would not need .astimezone() to both create a tzinfo and convert the datetime instance to it.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Still, I agree that this was a hack and a very similar hack to the one implemented by pytz.   Hopefully once PEP 495 is implemented we will shortly see "as intended" tzinfos to become more popular.</div></div></blockquote></div><br></div><div class="gmail_extra">The repeated claims (by Alexander?) that astimezone() has the power of pytz's localize() need to stop. Those pytz methods work for any (pytz) timezone -- astimezone() with a default argument only works for the local time zone. (And indeed what it does is surprising, except perhaps to pytz users.)<br><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div></div>