Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96478 > unrolled thread
| Started by | Tim Peters <tim.peters@gmail.com> |
|---|---|
| First post | 2015-09-12 20:58 -0500 |
| Last post | 2015-09-12 20:58 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? Tim Peters <tim.peters@gmail.com> - 2015-09-12 20:58 -0500
| 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? |
| Message-ID | <mailman.460.1442109551.8327.python-list@python.org> |
[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 top | Article view | comp.lang.python
csiph-web