[Python-Dev] Status on PEP-431 Timezones

Chris Angelico rosuav at gmail.com
Mon Jul 27 16:34:01 CEST 2015


On Tue, Jul 28, 2015 at 12:13 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Mon, Jul 27, 2015 at 10:54:02AM +0200, Lennart Regebro wrote:
>> On Mon, Jul 27, 2015 at 10:47 AM, Paul Moore <p.f.moore at gmail.com> wrote:
>> > I'm confused by your position. If it's 7am on the clock behind me,
>> > right now, then how (under the model proposed by the PEP) do I find
>> > the datetime value where it will next be 7am on the clock?
>>
>> PEP-431 does not propose to implement calendar operations, and hence
>> does not address that question.
>
> To me, Paul's example is a datetime operation: you start with a datetime
> (7am today), perform arithmetic on it by adding a period of time (one
> day), and get a datetime as the result (7am tomorrow).
>
> To my naive mind, I would have thought of calendar operations to be
> things like:
>
> - print a calendar;
> - add or remove an appointment;
> - send, accept or decline an invitation
>
> What do you think calendar operations are, and how do they differ from
> datetime operations? And most importantly, how can we tell them apart?
>

Concrete example: I meet with my students on a weekly basis, with the
scheduled times being defined in the student's timezone. For instance,
I might meet with a student every Thursday at 1PM America/Denver. When
there's a DST switch in that timezone, our meetings will be either 167
or 169 hours apart. I want a script that waits until five minutes
before my next meeting (with anyone) and then plays "Let It Go" in a
randomly-selected language. How would I go about doing this with pytz
and/or datetime? How would I do this under the new proposal? (FWIW, I
currently have exactly such a script, but it's backed by my Google
Calendar. I'm seriously considering rewriting it to use a simple text
file as its primary source, in which case my options are Python
(datetime+pytz) and Pike (built-in Calendar module). This does not
strike me as an altogether unusual kind of script to write.)

And no, Steve, you're not the only one. But maybe the entire thread
should completely halt until there's a PEP draft to discuss, and
*then* reopen on -ideas.

ChrisA


More information about the Python-Dev mailing list