Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96478
| References | (4 earlier) <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> |
|---|---|
| From | Tim Peters <tim.peters@gmail.com> |
| Date | 2015-09-12 20:58 -0500 |
| Subject | Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.460.1442109551.8327.python-list@python.org> (permalink) |
[Guido]
>> Those pytz methods work for any (pytz) timezone -- astimezone() with a
>> default argument only works for the local time zone.
{Alex]
> That's what os.environ['TZ'] = zonename is for. The astimezone() method
> works for every timezone installed on your system. Try it - you won't even
> need to call time.tzset()!
I tried it. It makes no difference to anything for me. I stay on
Windows to remind people that millions of Python users don't see any
of the horrid nonsense Linuxish systems force on poor users ;-)
> ...
> In any case, there are three approaches to designing a TZ database interface
> in the datetime module: the "as intended" approach, the pytz approach and
> the astimezone(zonename:str) approach.
Portability rules out #3, unless Python bundles its own zoneinfo wrapping.
pytk's approach has many attractions, like no need for `fold` and no
breakage of anything, and blazing fast .utcoffset(). Except at least
<datetime, timedelta> arithmetic would have to be patched to do a
`normalize` variant by magic (to attach the now-appropriate
fixed-offset tzinfo, but without changing the clock in the process).
Alas, that would be a huge speed hit for classic arithmetic.
So, as always, the original intent is the only one that makes sense in
the end ;-)
> ...
> That's why I believe PEP 495 followed by the implementation
> of fold-aware "as intended" tzinfos (either within stdlib or by third
> parties) is the right approach.
Me too - except I think acceptance of 495 should be contingent upon
someone first completing a fully functional (if not releasable)
fold-aware zoneinfo wrapping. Details have a way of surprising, and
we should learn from the last time we released a tzinfo spec in the
absence of any industrial-strength wrappings using it.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? Tim Peters <tim.peters@gmail.com> - 2015-09-12 20:58 -0500
csiph-web