<div dir="ltr"><div><div><div><div><div>Alexander,<br><br></div>Great stuff -- thanks for takign the time to write all this up so clearly -- for what really is a tiny change!<br><br></div>( and very good that that is the only thing this PEP is covering)<br><br></div>My one comment:<br><br></div>It seems that a "missing" time really should be an Error -- like Feb 29th in a non-leap year.<br><br></div>However, in the PEP:<br><div><div><br><p>"""</p><p>When a
      <tt class="docutils literal">
       datetime.datetime
      </tt>
      instance
      <tt class="docutils literal">
       dt
      </tt>
      represents a missing
time, there is no value
      <tt class="docutils literal">
       s
      </tt>
      for which:
     </p>
     <pre class="literal-block">datetime.fromtimestamp(s) == dt
</pre>
     <p>
      but we can form two "nice to know" values of
      <tt class="docutils literal">
       s
      </tt>
      that differ
by the size of the gap in seconds.  One is the value of
      <tt class="docutils literal">
       s
      </tt>
      that would correspond to
      <tt class="docutils literal">
       dt
      </tt>
      in a timezone where the UTC offset
is always the same as the offset right before the gap and the
other is the similar value but in a timezone the  UTC offset
is always the same as the offset right after the gap.
     </p>
     <p>
      The value returned by
      <tt class="docutils literal">
       dt.timestamp()
      </tt>
      given a missing
      <tt class="docutils literal">
       dt
      </tt>
      will be the larger of the two "nice to know" values
if
      <tt class="docutils literal">
       dt.first  == True
      </tt>
      and the smaller otherwise.
     </p>"""<br><br></div><div>I _think_ I recall form this discussion that this was done, rather than an error, because it was decided that such calls should never raise an exception (also, the replace() functionality makes it all too likely). So it's probably best to do it in the proposed way, but the PEP should make it clear that a prime motivation is to avoid Exceptions in such code.<br><br></div><div>-Chris<br><br></div><div><br><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 15, 2015 at 5:49 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">PEP 495 [1] is a deliberately minimalistic proposal to remove an<br>
ambiguity in representing some local times as datetime.datetime<br>
objects.<br>
<br>
The concept has been extensively discussed on python-ideas and this<br>
mailing list.  I believe a consensus has been reached and it is<br>
reflected in the PEP.<br>
<br>
PEP 495 does not propose any changes to datetime/timedelta<br>
arithmetics, but it has been agreed that it is a necessary step for<br>
implementing the "strict" rules.<br>
<br>
[1]: <a href="https://www.python.org/dev/peps/pep-0495" rel="noreferrer" target="_blank">https://www.python.org/dev/peps/pep-0495</a><br>
_______________________________________________<br>
Datetime-SIG mailing list<br>
<a href="mailto:Datetime-SIG@python.org">Datetime-SIG@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/datetime-sig" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/datetime-sig</a><br>
The PSF Code of Conduct applies to this mailing list: <a href="https://www.python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">https://www.python.org/psf/codeofconduct/</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div>