Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

All syllogisms have three parts, therefore this is not a syllogism.


devel / comp.lang.python / Re: Pre-Pre-PEP: The datetime.timedeltacal class

SubjectAuthor
o Re: Pre-Pre-PEP: The datetime.timedeltacal classPeter J. Holzer

1
Re: Pre-Pre-PEP: The datetime.timedeltacal class

<mailman.151.1650206043.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17906&group=comp.lang.python#17906

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Pre-Pre-PEP: The datetime.timedeltacal class
Date: Sun, 17 Apr 2022 16:34:01 +0200
Lines: 86
Message-ID: <mailman.151.1650206043.20749.python-list@python.org>
References: <20220416173551.fk6voaa3o25iuewm@hjp.at>
<CAPTjJmqdd4Qwrr72h4Y28dhZ_JXa9VSJFWmHXt4KfD-eNMwOTA@mail.gmail.com>
<20220417081554.wewkrvvl2xmiygsm@hjp.at>
<20220417143401.ppevrrtawkybafq3@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="i6ssgimnpd74wqsw"
X-Trace: news.uni-berlin.de 6vN+OfHMXsCRGFGTWF1MxgRM53jx+xRN07YoKy+JXiPA==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2022': 0.05; 'content-
type:multipart/signed': 0.05; 'sun,': 0.07; 'utc': 0.07;
'angelico': 0.09; 'anyway,': 0.09; 'cases.': 0.09; 'content-
type:application/pgp-signature': 0.09; 'datetime': 0.09;
'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'float': 0.09; 'smaller': 0.09; 'subject:class': 0.09;
'"computer': 0.16; '"creative': 0.16; '+0200,': 0.16; '__/': 0.16;
'arbitrary': 0.16; 'challenge!"': 0.16; 'from:addr:hjp-python':
0.16; 'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'hjp@hjp.at': 0.16; 'holzer': 0.16; 'hours,': 0.16; 'instead.':
0.16; 'position".': 0.16; 'reality.': 0.16; 'right.': 0.16;
'seconds.': 0.16; 'shorter': 0.16; 'sounds': 0.16; 'stross,':
0.16; 'subject:Pre': 0.16; 'subject:skip:d 20': 0.16; 'sunday':
0.16; 'time",': 0.16; 'unlikely': 0.16; 'url-
ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24': 0.16; 'url-
ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:':
0.16; "aren't": 0.19; 'to:addr:python-list': 0.20; "i've": 0.22;
'advanced': 0.22; 'weeks': 0.23; 'cities': 0.26; 'months,': 0.26;
'local': 0.27; 'chris': 0.28; 'mostly': 0.28; 'sense': 0.28;
'thinking': 0.28; 'annual': 0.31; 'think': 0.32; "doesn't": 0.32;
'minutes,': 0.32; 'split': 0.32; "wouldn't": 0.32; 'but': 0.32;
"i'm": 0.33; 'there': 0.33; 'same': 0.34; 'header:In-Reply-To:1':
0.34; '"the': 0.35; 'bar': 0.35; 'yes,': 0.35; 'months': 0.35;
'change': 0.36; "it's": 0.37; 'class': 0.37; 'could': 0.38;
'added': 0.39; 'subject:PEP': 0.39; 'still': 0.40; 'hand': 0.40;
'seconds': 0.40; 'should': 0.40; 'received:212': 0.62; 'days':
0.62; "you'd": 0.64; 'look': 0.65; 'years': 0.65;
'received:userid': 0.66; 'decided': 0.67; 'time,': 0.67; 'right':
0.68; 'matter': 0.68; 'days,': 0.69; 'stores': 0.69; 'url-
ip:212/8': 0.69; 'times': 0.69; 'subject:The': 0.70; 'longer':
0.71; 'charset:iso-8859-1': 0.73; 'database': 0.80; 'amount,':
0.84; 'bar,': 0.84; 'leap': 0.84; 'minutes?': 0.84; 'received:at':
0.84; 'represented': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <20220417081554.wewkrvvl2xmiygsm@hjp.at>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <20220417143401.ppevrrtawkybafq3@hjp.at>
X-Mailman-Original-References: <20220416173551.fk6voaa3o25iuewm@hjp.at>
<CAPTjJmqdd4Qwrr72h4Y28dhZ_JXa9VSJFWmHXt4KfD-eNMwOTA@mail.gmail.com>
<20220417081554.wewkrvvl2xmiygsm@hjp.at>
 by: Peter J. Holzer - Sun, 17 Apr 2022 14:34 UTC
Attachments: signature.asc (application/pgp-signature)

On 2022-04-17 10:15:54 +0200, Peter J. Holzer wrote:
> On 2022-04-17 06:08:54 +1000, Chris Angelico wrote:
> > On Sun, 17 Apr 2022 at 03:37, Peter J. Holzer <hjp-python@hjp.at> wrote:
> > > Therefore a new class (provisionally called timedeltacal, because it is
> > > calendaric, not absolute) should be added to datetime:
> > >
> > > Internally it stores months, days, seconds and microseconds as ints.
> > >
> > > The seconds and microseconds split is mostly for compatibility with
> > > datetime and timedelta. We could store seconds as a float instead.
> > >
> > > We don't store minutes since leap seconds aren't usually represented in
> > > "computer time", so they are unlikely to be useful in a timedeltacal
> > > object.
> > >
> > > Days are stored since they aren't a fixed multiple of any smaller unit.
> > > Months are stored since they aren't a fixed multiple of any smaller unit.
> > >
> > > Hours, weeks and years aren't stored since they are always 60 minutes, 7
> > > days and 12 months respectively.
> >
> > It sounds like you're planning for annual DST changes, but what about
> > other shifts? What about when a location adopts standard time, which
> > could change their UTC offset (yes, I'm aware that most places adopted
> > standard time before UTC was a thing, but we still usually call it a
> > UTC offset rather than messing with GMT-UTC changeover) by an
> > arbitrary amount, even minutes?
>
> Yes, I think you are right. I first thought it wouldn't matter because
> you'd have to look it up in the database anyway, but that's a
> non-sequitur. Clearly, when you cities switched from local times to
> timezones, one hour had to be longer or shorter than 3600 seconds.
> Similarily if India decided to switch to a whole-hour offset, then they
> would have one hour of 30 or 90 minutes.

Thinking about it some more (while writing test cases) I've changed my
mind again. I think "1 hour" should always be 3600 seconds (disregarding
leap seconds), not "the time until the hour hand has advanced by 30° and
the minute hand is in the same position". If I sit at a bar at 00:30 on
the last Sunday in March, and I continue to sit there for 2 hours, then
it's 03:30 when I get out of the bar, not 02:30. 02:30 doesn't even
exist.

That might be considered an inconsistency, but I think it "does the
right thing" in most cases.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor