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


Groups > comp.lang.python > #96595

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

References (17 earlier) <201509140827.t8E8RPqb001076@fido.openend.se> <CAExdVNn2wM8YW=Jg=aM86X6RaaVYPTioTSJ2d1gGp0k76CN3mg@mail.gmail.com> <1442257996.253100.383441705.7A0986C7@webmail.messagingengine.com> <CAExdVN=s_V_uz9mSOtp6b6+fKjqLZHArXKUQ-ty5EYkLM5V2qw@mail.gmail.com> <CAP7h-xa3fu5Yo5GGdqDiM-vgxFJnwW9SQYW9Hcm1+Jfpy6csmA@mail.gmail.com>
From Tim Peters <tim.peters@gmail.com>
Date 2015-09-14 14:49 -0500
Subject Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?
Newsgroups comp.lang.python
Message-ID <mailman.558.1442260211.8327.python-list@python.org> (permalink)

Show all headers | View raw


[Tim]
>> It would be nice to have!  .utcoffset() is an expensive operation
>> as-is, and being able to rely on tm_gmtoff would make that dirt-cheap
>> instead.

[Alex]
> If it  is just a question of optimization,

Yes.  If it's more than just that, then 495 doesn't actually solve the
problem of getting the correct UTC offset in all cases.


> datetime objects can be extended to cache utcoffset.  Note that PyPy
> have recently added caching of the hash values in datetime objects.  I
> merged their changes in our datetime.py, but it did not look like C
> implementation would benefit from it as much as pure python did.  I
> expect something similar from caching utcoffset: a measurable
> improvement for tzinfos implemented in Python and a wash for those
> implemented in C.  (A more promising optimization approach is to define a C
> API for tzinfo interface.)

There's no answer to this.  It depends on how expensive .utcoffset()
is, which in turn depends on how the tzinfo author implements it.

I don't care now fast it is.  But, even if I did, "premature
optimization" applies at this time ;-)

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-14 14:49 -0500

csiph-web