[Datetime-SIG] is_dst flag

Felipe Ochoa felipe.nospam.ochoa at gmail.com
Wed Jul 29 18:20:19 CEST 2015


In the hopes of separating the discussion into the various sub-issues,
here's what I think is the status on the is_dst flag.

(Guido) From '[Datetime-SIG] The BDFL's take'
> - An "is_dst" flag for datetime objects. Again, this should default to
> "backwards compatible" (== "don't care", the -1 value in struct tm) so that
> pickles are two-way compatible with Python 3.5 and before.


The key thing here is that the flag is **on the datetime object**, (in
addition, timezone objects can keep track of whatever they internally
need). This flag is only necessary for local times with a timezone that can
occur twice. The typical use-case is, e.g., 1.30am on the day that clocks
turn back for DST in the US. `datetime(2002, 10, 27, 1, 30, 0,
tzinfo=zoneinfo('America/New_York')` is ambiguous, and the point of the
is_dst flag is to determine which of the two possible moments the datetime
refers to. Note that the ambiguity is only a factor when converting to
another timezone (or a unix timestamp).

Sidenote: Per earlier discussion, this flag should probably have a
different name to clarify that it only applies in ambiguous cases, and is
not just a DST problem (For another example, see the pytz docs
<http://pytz.sourceforge.net/#problems-with-localtime> and search for
Warsaw).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/datetime-sig/attachments/20150729/e20c2242/attachment.html>


More information about the Datetime-SIG mailing list