Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96524

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <tim.peters@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:: [': 0.03; 'api.': 0.04; '(so': 0.07; 'cc:addr:python-list': 0.09; 'creighton': 0.09; 'dst,': 0.09; 'span': 0.09; 'tickets.': 0.09; 'wrong,': 0.09; 'python': 0.10; 'packages.': 0.15; 'result.': 0.15; '"to': 0.16; 'already,': 0.16; 'railroad': 0.16; 'received :mail-oi0-x22a.google.com': 0.16; 'relatives': 0.16; 'remembered': 0.16; 'scrape': 0.16; "time'": 0.16; 'uses,': 0.16; 'utc.': 0.16; 'of.': 0.18; '(in': 0.18; ';-)': 0.18; 'subject:] ': 0.19; '>>>': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'clock': 0.22; 'occurs': 0.22; 'subject:skip:i 10': 0.22; 'header:In-Reply-To:1': 0.24; 'sort': 0.25; 'message-id:@mail.gmail.com': 0.27; 'transition': 0.27; 'correct': 0.28; 'arrival': 0.29; 'pep': 0.29; "i'm": 0.30; 'print': 0.30; 'supposed': 0.31; 'getting': 0.33; 'case,': 0.34; 'schedule': 0.34; 'add': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'problem.': 0.35; 'but': 0.36; 'basic': 0.36; 'heard': 0.36; 'subject:" ': 0.36; 'subject:?': 0.36; 'expect': 0.37; 'itself': 0.38; 'anything': 0.38; 'end': 0.39; 'sure': 0.39; 'whatever': 0.39; 'subject:-': 0.39; 'him': 0.60; 'your': 0.60; 'determine': 0.61; 'avoid': 0.61; 'back': 0.62; 'distance': 0.63; 'here:': 0.63; 'times': 0.63; 'between': 0.65; 'subject:there': 0.66; 'account': 0.66; 'hour': 0.69; 'soul': 0.72; '495': 0.84; 'arrival,': 0.84; 'subject:any': 0.84; 'traveler': 0.84; 'via,': 0.84; 'dozen': 0.91; 'railway': 0.91; 'time)': 0.91; 'subject:Are': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=YGNAojaByBqp2FqbE11eH+ZaXzh7BiAaRzQOcwFk2ik=; b=nDy6wwctHT3aLF4pLnYgV9nm+SXL4l5/mtDkpa6wpQMm9diY8JHs4I92TDuYiMMyeC UcmtW9ri5bibe6yFmgHBQ7y+C3C2gjKvTP9iu+EcRtaWereRu6tc/npuyG7yS+oRXumO QZ/097sz/gVy0KLujoZBB4yT8dx0KEV8JW2/4TwV04nDF5JxL3dwM+s7/jWheVYptR5X TApn2FcaAxL509qrQhCMDGiedK9XMPEYVJZzORlsjpeUdrPQ2R7QnB2vJi0clsxGMcNK qAyWoHz92qDM2oxt0x2YubHU9pbuGGYLD82kFaSYBhwVdqxf2HBIdI1tKZ5jR1tSIjS8 pApg==
X-Received by 10.202.213.70 with SMTP id m67mr7930768oig.26.1442175248231; Sun, 13 Sep 2015 13:14:08 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <201509131940.t8DJe36w015280@fido.openend.se>
References <m2h9mzqyy7.fsf@fastmail.com> <CAExdVNm0rrxhbSONfQdor7e=9t+6Tg3hh6eFq-h0NnfdpteVYg@mail.gmail.com> <1442085362.324875.381920729.5E7A6DCE@webmail.messagingengine.com> <CAExdVNnUwRKN2q=trpnD9=mxnXvuosWKO+s5=PCfjAO45-Yugw@mail.gmail.com> <CAP7h-xYFAggqbJBNCZbYFwUqCPzW7-4Rc0x_SzgAumpFYAr6oA@mail.gmail.com> <CAExdVNmfTsqunRR_b-Q1YqWrTjsV1L5ppAoAnL7SUwgR2PFU0A@mail.gmail.com> <CAP7h-xbqq2Eu+vVO2g4WmbRJ=gmL1r9D2sWhKe=qQ8Ev-n415w@mail.gmail.com> <CAP7+vJ+1Vg21qOWAD+9R2REDnWiW4o6nj=Rh8fx3x3cAZipcdw@mail.gmail.com> <CAP7h-xbA6ZagKj+rQ_cCc8d0oK1F329AAhSjY240iiDyB4756A@mail.gmail.com> <CAExdVNnw6zfJQ_wFOurjj6kcLcbr9RgXA7kvyNPmgraMcHU4vQ@mail.gmail.com> <CAP7h-xYp=MsOcvFXNCHNkXDDGH=jcAwYSSw1WWchy5bwZKjwLA@mail.gmail.com> <201509131224.t8DCOXHO004891@fido.openend.se> <CAExdVNkN465=bWeY61PFAxpiUQ-u0p2zaqtwH8PQWyQO4Jw9Mg@mail.gmail.com> <201509131600.t8DG07e0025688@fido.openend.se> <CAExdVNm3e43mJ3tqcUc9175WssV4zeuO024svJbMTjrTab=Qew@mail.gmail.com> <201509131940.t8DJe36w015280@fido.openend.se>
From Tim Peters <tim.peters@gmail.com>
Date Sun, 13 Sep 2015 15:13:53 -0500
Subject Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?
To Laura Creighton <lac@openend.se>
Cc Python-List <python-list@python.org>, datetime-sig <datetime-sig@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.496.1442175250.8327.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442175250 news.xs4all.nl 23822 [2001:888:2000:d::a6]:39860
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96524

Show key headers only | View raw


[Laura]
>>> But I am not sure how it is that a poor soul who just wants to print a
>>> railway schedule 'in local time' is supposed to know that Creighton is
>>> using Winnipeg time.

[Tim]
>> I'm not sure how that poor soul would get a railway schedule
>> manipulable in Python to begin with ;-)

[Laura]
> Via Rail will give you a schedule when you book your tickets.  But I
> am wrong, it gives it to you in local time, which you can scrape or
> even use the via rail api.  So it is the person getting off in
> Creighton who wants to tell his relatives back in Halifax what
> time he is arriving (in their time) (so they can call him and
> avoid the hellish hotel surtax on long distance calls) who will
> have the problem.

Whatever time zone the traveler's railroad schedule uses, so long as
it sticks to just one the traveler subtracts the departure time from
the arrival time to determine how long the trip takes.  They add that
to the Halifax time at which they depart, and tell their Halifax
relatives the result.  They don't need to know anything about the
destination's time zone to do this, unless a daylight transition
occurs between departure and arrival, and the schedule itself
remembered to account for it.  In which case, pragmatically, they can
just add an hour "to be safe" ;-)


> And this is the sort of use case I think we will see a lot of.

But there's nothing new here:  datetime has been around for a dozen
years already, and nobody is proposing to add any new basic
functionality to tzinfos.  PEP 495 is only about adding a flag to
allow correct conversion of ambiguous local times (typically at the
end of DST, when the local clock repeats a span of times) to UTC.  So
if this were a popular use case, I expect we would already have heard
of it.  Note that Python zoneinfo wrappings are already available via,
at least, the pytz and dateutil packages.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? Tim Peters <tim.peters@gmail.com> - 2015-09-13 15:13 -0500

csiph-web