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?

Path csiph.com!news.swapon.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'cache': 0.05; 'implements': 0.07; 'pypy': 0.07; 'api': 0.09; 'cc:addr:python-list': 0.09; 'merged': 0.09; 'objects.': 0.09; 'python': 0.10; 'applies': 0.15; 'instead.': 0.15; 'caching': 0.16; 'did,': 0.16; 'did.': 0.16; 'utc': 0.16; ';-)': 0.18; 'subject:] ': 0.19; 'changes': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**2': 0.20; 'subject:skip:i 10': 0.22; 'implemented': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'define': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'correct': 0.28; 'this.': 0.28; 'values': 0.28; 'cases.': 0.29; 'hash': 0.29; 'promising': 0.29; 'objects': 0.29; 'expensive': 0.32; 'getting': 0.33; 'problem': 0.33; 'similar': 0.33; 'that,': 0.34; 'received:google.com': 0.35; 'something': 0.35; 'but': 0.36; 'depends': 0.36; 'subject:" ': 0.36; 'subject:?': 0.36; 'being': 0.37; 'expect': 0.37; 'turn': 0.37; 'subject:-': 0.39; 'care': 0.60; 'is.': 0.63; 'more': 0.63; 'our': 0.64; 'benefit': 0.66; 'subject:there': 0.66; '495': 0.84; 'measurable': 0.84; 'received :mail-ob0-x22d.google.com': 0.84; 'subject:any': 0.84; 'wash': 0.84; 'improvement': 0.93; '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=r13LCEUaFSq/0YlLesjhv22CnkY/zlIfdqF3v10Q4LU=; b=HHTjKij6pF3aj0yK0akxZBC4fziDO9GazyseZ8k4JHiidHTwg26vIWU3e0QcCA3JLm DvLzzenwIl1evrgSW+F6hx5chgtLTqQOor8JHvrC8BKtp4DV5m08WRK/jCwtSvXGfE/l BdaXPxWXW7UcLW6U2sn+aSnovBP2Qi9aTUL46g73Gd6huDfRkHfWeXrtrCaLcaZi3bn4 wPdnCFCdpXDdXcNrl7Ncj1uNEx8Fm1B+gHIWJQnwOEHJzONm29IJqgC1SAopyUzMLO/+ hxdVzGJSgaz3Ju2te60PYbCWy2WLaRTcWn7r0AFR68iO8IG51+/D4G1omisxwUEhG67L CACw==
X-Received by 10.182.168.114 with SMTP id zv18mr13293812obb.84.1442260208263; Mon, 14 Sep 2015 12:50:08 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAP7h-xa3fu5Yo5GGdqDiM-vgxFJnwW9SQYW9Hcm1+Jfpy6csmA@mail.gmail.com>
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> <201509132031.t8DKVTwJ028027@fido.openend.se> <CAExdVNkeRVgV8CXLugMgqhUSuXU=qHYSFUo24Xw83X=8tVBjCg@mail.gmail.com> <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 Mon, 14 Sep 2015 14:49:53 -0500
Subject Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?
To Alexander Belopolsky <alexander.belopolsky@gmail.com>
Cc Random832 <random832@fastmail.com>, 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.558.1442260211.8327.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442260211 news.xs4all.nl 23807 [2001:888:2000:d::a6]:56951
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96595

Show key headers only | 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