On 08/24/2015 05:23 PM, Alexander Belopolsky wrote: > > On Mon, Aug 24, 2015 at 7:01 PM, Carl Meyer <[email protected] > <mailto:[email protected]>> wrote: > > On 08/24/2015 03:58 PM, ISAAC J SCHWABACHER wrote: > > [ijs] > >>> I see how PEP 495 makes it possible to convert datetimes correctly > >>> in all cases, > >> > > [Tim Peters] > >> Whew! You may well be only the second person to grasp this - thanks > :-) > > > > Wait... was this ever in contention? > > I don't think so. I'm not sure what Tim is referring to here; I haven't > seen any messages in this thread that indicated a lack of understanding > on this point. > > > I cannot speak for Tim, but here is an exercise you can try to check > your grasp of PEP 495: given PEP-compliant utcoffset() and dst() methods > for the current rules in the US/Eastern timezone, write a PEP-compliant > fromutc(). You can start from the current datetime.py implementation. [1] > > [1]: https://hg.python.org/cpython/file/v3.5.0rc1/Lib/datetime.py#l957
Looks fun; I'll give it a try later tonight. But you're changing the subject. That exercise requires far more detailed knowledge of the tzinfo APIs than is required to understand that a single added disambiguating bit is enough to handle timezone conversions, even in the presence of (two-layered) folds and gaps. I haven't seen anyone object to PEP 495 on the grounds that it doesn't provide enough information to handle timezone conversions (well, except in the as-yet-hypothetical case of a three-layered fold, which could be handled by your latest proposal to make `ltdf` an integer rather than a boolean). I've seen a lot of discussion of the name of the flag, and a couple people express a desire to have a simpler built-in spelling of "raise an exception on invalid/ambiguous time" than "convert twice with two different flag values and compare the results". Carl
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Datetime-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/datetime-sig The PSF Code of Conduct applies to this mailing list: https://www.python.org/psf/codeofconduct/
