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


Groups > comp.lang.python > #96608

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

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'context': 0.05; 'bits': 0.07; 'bytes.': 0.07; 'cc:addr:python- list': 0.09; '"could': 0.09; 'bits.': 0.09; 'received:internal': 0.09; 'apps': 0.15; 'argument': 0.15; '(well,': 0.16; 'bit.': 0.16; 'fold': 0.16; 'loud': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'naive': 0.16; 'nevertheless': 0.16; 'pairs': 0.16; 'peters': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'sorting': 0.16; 'wrote:': 0.16; 'string': 0.17; 'abuse': 0.18; ';-)': 0.18; 'subject:] ': 0.19; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'arguments': 0.22; 'sep': 0.22; 'sorry,': 0.22; 'subject:skip:i 10': 0.22; 'bit': 0.23; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'sort': 0.25; 'wonder': 0.27; '(e.g.,': 0.27; '14,': 0.27; 'arithmetic': 0.29; 'pep': 0.29; 'pickle': 0.29; 'types.': 0.29; 'work.': 0.30; 'older': 0.32; 'maybe': 0.33; 'third': 0.33; 'common': 0.33; 'algorithms.': 0.33; 'list': 0.34; 'gives': 0.35; 'so,': 0.35; 'done': 0.35; 'formats': 0.35; 'today?': 0.35; "isn't": 0.35; 'but': 0.36; 'there': 0.36; 'subject:" ': 0.36; 'subject:?': 0.36; 'received:10': 0.37; 'two': 0.37; 'received:66': 0.38; 'why': 0.39; 'format': 0.39; "didn't": 0.39; 'subject:-': 0.39; 'where': 0.40; 'space': 0.40; 'called': 0.40; 'some': 0.40; 'future': 0.60; 'determine': 0.61; 'increased': 0.61; 'share': 0.61; 'header:Message-Id:1': 0.61; 'skip:n 10': 0.62; 'within': 0.64; 'subject:there': 0.66; "they're": 0.66; '495': 0.84; "it'd": 0.84; 'occupied': 0.84; 'subject:any': 0.84; 'we?': 0.84; 'subject:Are': 0.95
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=X6D4jSsOrkEpqQfjIYWBDOsbKM0=; b=V9YqaP 22YuN4CHkC86MGt33tIYnHl5EjCGDl/yxhDzz/tU56SM28rRKnIw4yoOi6dlu3iB LHxCN6HwX9VWfz/Nw1mBd28xxGy622V4O4M9CPoaadyBPWcUHvrBQsRzCK5usVAo Y+6fqaaumnE5zYfcnqsDaHDqP6TWjHr72WMuw=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=X6D4jSsOrkEpqQf jIYWBDOsbKM0=; b=CRUuBp95XRL15N988sR/uXiF7fnz5P6UKcYGIuA8Z/cwVNc Ltm8gwxzJCcH40AkwGCFRa7kqYu+njV1bKuMP7ZP9bQE6H1dl8RvY7cWuyby6XMW am/7Ohwl5vSKj4StItm5mhmnCTOk6DQNn5RGEQ1Kf0yjKkZMx828RmFcHc1s=
X-Sasl-Enc 66xTZ7cs1OEQRvdNp8tlRmZ/mdBtSviNAU1JGjn/AoAh 1442267635
From Random832 <random832@fastmail.com>
To Tim Peters <tim.peters@gmail.com>
Cc "Python-List" <python-list@python.org>, "datetime-sig" <datetime-sig@python.org>
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-c76b43ce
In-Reply-To <CAExdVNnJG3-wz1fLtV2wLb+cbHQstc0Zh-KGxBFj6Q5CeqQpEw@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> <1442260714.263025.383475777.4728D768@webmail.messagingengine.com> <CAExdVN=OWrFxYiuNZrWuVHfeT74VyXaUOXLKj0Q1Ai1SoupqbQ@mail.gmail.com> <1442262425.268793.383506657.0443601E@webmail.messagingengine.com> <CAExdVNmNL4oiGWjokOmvKaWvqPdsp2kuGKYGJ-aERRB+irQU8A@mail.gmail.com> <1442265800.280460.383547057.16B65298@webmail.messagingengine.com> <CAExdVNnJG3-wz1fLtV2wLb+cbHQstc0Zh-KGxBFj6Q5CeqQpEw@mail.gmail.com>
Subject Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo?
Date Mon, 14 Sep 2015 17:53:55 -0400
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.575.1442267638.8327.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442267638 news.xs4all.nl 23812 [2001:888:2000:d::a6]:58268
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96608

Show key headers only | View raw


On Mon, Sep 14, 2015, at 17:34, Tim Peters wrote:
> Yes, we "could have" done that for all pickle formats for all types.
> But why on Earth would we?  Pickle size is important to many apps
> (e.g., Zope applications can store billions of pickles in databases.
> and it may not be purely coincidence ;-) that Zope Corp paid for
> datetime development), and there would have been loud screaming about
> any "wasted" bytes.

Would allowing a 16-byte string in the future have increased the storage
occupied by a 10-byte string today? Would allowing a third argument in
the future have increased the storage occupied by two arguments today?
As far as I can tell the pickle format for non-primitive types isn't
_that_ fixed-width.

> > That you didn't makes me wonder just where you're finding the space to put the
> > fold bit.
> 
> PEP 495 gives all the details.  Short course:  there are bits that are
> _always_ 0 now within some datetime pickle bytes.  `fold` will abuse
> one of those always-0-now pickle bits.

And what happens to older implementations if that bit is 1?

> Aware datetimes _within_ a zone also follow the naive time model.
> It's unfortunate that they're nevertheless called "aware" datetimes.
> 
> So, sorry, even when sorting a list of aware datetimes, if they share
> a common zone it is wholly intended that they all work in naive time.

And if some of them share a common zone, then some of them will work in
naive time, and some of them will work in aware time, and some pairs
(well, triples) of them will cause problems for sort/bisect algorithms.

Maybe it'd be best to simply ban interzone comparisons. Or have some
sort of context manager to determine how arithmetic and comparisons
work.

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


Thread

Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? Random832 <random832@fastmail.com> - 2015-09-14 17:53 -0400

csiph-web