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


Groups > comp.lang.python > #69184

Re: YADTR (Yet Another DateTime Rant)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'argument': 0.05; 'output': 0.05; 'that?': 0.05; 'indicating': 0.07; 'notice,': 0.07; 'skip:\\ 20': 0.07; 'tries': 0.07; 'string': 0.09; 'negative.': 0.09; 'oh,': 0.09; 'skip:\\ 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '"-"': 0.16; "'''": 0.16; '10:05': 0.16; 'arbitrary.': 0.16; 'declaration': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mine.': 0.16; 'positive,': 0.16; 'repr': 0.16; 'repr()': 0.16; 'slip': 0.16; 'subclass': 0.16; 'wrote:': 0.18; '(but': 0.19; 'possible,': 0.19; 'thu,': 0.19; '>>>': 0.22; 'portion': 0.22; 'rules': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'days,': 0.24; 'hours,': 0.24; 'logical': 0.24; 'propose': 0.24; 'cc:2**0': 0.24; '(for': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'fixed': 0.29; 'chris': 0.29; 'patch': 0.29; "doesn't": 0.30; 'mix': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'that.': 0.31; 'argue': 0.31; 'bad.': 0.31; 'follows': 0.31; 'yields': 0.31; 'everyone': 0.33; 'actively': 0.33; 'raw': 0.33; 'could': 0.34; 'subject: (': 0.35; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'like,': 0.36; 'representing': 0.36; 'next': 0.36; "didn't": 0.36; 'possible': 0.36; 'should': 0.36; 'changing': 0.37; 'positive': 0.37; 'pm,': 0.38; 'does': 0.39; 'either': 0.39; 'days': 0.60; 'even': 0.60; 'negative': 0.60; 'no.': 0.61; 'took': 0.61; 'simple': 0.61; 'interest': 0.64; 'different': 0.65; 'taking': 0.65; 'hours': 0.66; 'mar': 0.68; 'legal': 0.71; 'prime': 0.74; 'day': 0.76; '"real': 0.84; 'short,': 0.84; 'situations,': 0.84; 'stability': 0.84; 'apparent': 0.91; 'to:none': 0.92; 'besides,': 0.93; 'suffer': 0.93; 'suited': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=gbwGfEe+3P4KYPlSa+U/BtAUb8m8RxIGB997EhcU+Vg=; b=SNUN0Ns6/nsPBfbbn72iloTu/es+KT6xdUNmiUyXzAjRK3vz1FlY0a+ZyBV6CYwCHf X7MZhGaJkFoaIG8Lo19nmAFk47uQQC2St0u3V6OwR78OEATpsLXIjZFiQ39cYA5rHVNs R8AYMZmPfLF1N3LMuG3rSIZ36hAmzjpdRw1W3Kpd22icAo5000LwOv53/LL9cHQBunnO Rry2wiQiNOk6ETzwIcsyUR9JpygTstd8fsYj/G7VD5ks/zyBHJZ4DWntbikIupC3u70v pU/knsx0dQ0eWhem/aNrzZDcl2YEApe/RtvNy3daXwp6oMu8rxn4kIyBrxAtzKFCU+Zz RzaA==
MIME-Version 1.0
X-Received by 10.66.129.133 with SMTP id nw5mr1282622pab.98.1395920035260; Thu, 27 Mar 2014 04:33:55 -0700 (PDT)
In-Reply-To <lh10l2$iak$1@news.albasani.net>
References <roy-142548.20582725032014@news.panix.com> <mailman.8593.1395876355.18130.python-list@python.org> <53336df8$0$29994$c3e8da3$5496439d@news.astraweb.com> <lh0u51$dj8$1@news.albasani.net> <mailman.8613.1395917059.18130.python-list@python.org> <lh10l2$iak$1@news.albasani.net>
Date Thu, 27 Mar 2014 22:33:55 +1100
Subject Re: YADTR (Yet Another DateTime Rant)
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.8614.1395920043.18130.python-list@python.org> (permalink)
Lines 81
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395920043 news.xs4all.nl 2958 [2001:888:2000:d::a6]:55462
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69184

Show key headers only | View raw


On Thu, Mar 27, 2014 at 10:05 PM, Johannes Bauer <dfnsonfsduifb@gmx.de> wrote:
> On 27.03.2014 11:44, Chris Angelico wrote:
>> On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer <dfnsonfsduifb@gmx.de> wrote:
>>> Besides, there's an infinite amount of (braindead) timedelta string
>>> representations. For your -30 hours, it is perfectly legal to say
>>>
>>> 123 days, -2982 hours
>>>
>>> Yet Python doesn't (but chooses an equally braindead representation).
>>
>> It's not "equally braindead", it follows a simple and logical rule:
>> Only the day portion is negative. That might not be perfectly suited
>> to all situations, but it does mean that adding and subtracting whole
>> days will never change the representation of the time. That's a
>> reasonable promise.
>
> Why would the stability of the *string* output of the time
> representation be of any interest whatsoever? Do you have any even
> halfways reasonable usecase for that?
>
>> What you propose is completely arbitrary,
>
> No. What I propose is that for t > 0 this holds:
>
> "-" + str(t) == str(-t)
>
> Which is far from arbitrary.

When you said "equally braindead", I took that as indicating that the
current representation is as braindead as "123 days, -2982 hours". My
point is that it's not as arbitrary as that. Your "real proposal", if
you like, is arguably better; but I'm just saying that the current one
isn't arbitrary.

> It follows "natural" rules of inverting
> something (-abs(x) == -x), and it yields a (truly) human-readable form
> of showing a timedelta.
>
> Please don't mix this up with the very apparent braindead proposal of
> mine. In case you didn't notice, this was irony at work. The word
> "braindead" I chose to describe the format should have tipped you off to
> that.

Yes, I knew that that was irony. I was taking argument with your
declaration that the current form is just as bad. Taking it to a
different type: The repr() of a string tries to be short, where
possible, by using either single or double quotes, but won't use a raw
representation, nor triple-quoted:

>>> ' \' '
" ' "
>>> " \" "
' " '
>>> ' \"\'\"\'\"\'\"\' '
' "\'"\'"\'"\' '
>>> " \"\'\"\'\"\'\"\' "
' "\'"\'"\'"\' '
>>> ''' "'"'"'"' '''
' "\'"\'"\'"\' '
>>> r' \\\\\\\\\\\\\\ '
' \\\\\\\\\\\\\\\\\\\\\\\\\\\\ '

You could argue that representing a string as raw or triple-quoted
would be "more correct", and yet the current repr is not arbitrary.
The current form is not actively bad, even if it would be possible to
find something better.

>>> Where can I enter a PIP that proposes that all timedelta strings are
>>> fixed at 123 days (for positive, non-prime amount of seconds) and fixed
>>> at -234 days (for all negative or positive prime amount of seconds)?
>>
>> Doesn't need a PEP. Just subclass it or monkey-patch it and use it as
>> you will. :)
>
> Nonono, you misunderstand: I want everyone to suffer under the braindead
> representation, just as it is now!

Oh, absolutely! In that case, just slip a patch into the next point
release; people won't mind that changing in 3.4.1!

ChrisA

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


Thread

YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-25 20:58 -0400
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-25 18:19 -0700
  Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-26 09:27 +0000
  Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 08:37 -0500
    Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 08:04 -0700
      Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 10:39 -0500
        Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 17:58 +0200
          Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 11:34 -0500
            Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 19:13 +0200
            Re: YADTR (Yet Another DateTime Rant) Grant Edwards <invalid@invalid.invalid> - 2014-03-26 19:12 +0000
              Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-27 07:06 +1100
      Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 11:50 -0400
  Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-26 15:02 +0100
    Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 16:43 +0200
  Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 01:12 +1100
    Re: YADTR (Yet Another DateTime Rant) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-27 11:08 +1300
  Re: YADTR (Yet Another DateTime Rant) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-03-26 19:25 -0400
    Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 00:16 +0000
      Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 12:28 +1100
        Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 21:38 -0400
          Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-27 08:40 +0000
      Re: YADTR (Yet Another DateTime Rant) Dan Sommers <dan@tombstonezero.net> - 2014-03-27 03:56 +0000
      Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 11:22 +0100
        Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 21:44 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:05 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:33 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:25 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:42 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 06:56 -0500
              Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-27 16:04 +0200
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 23:20 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 08:01 -0500
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 17:10 -0400
            Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-27 17:04 -0700
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 21:46 -0400
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 21:59 -0400
                Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 22:24 -0400
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 14:03 +1100
          Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 08:52 -0400
            Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-27 15:12 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 01:15 +1100
            Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 23:41 +0000
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 20:29 -0400
                Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-28 11:43 +1100
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 11:11 +0000
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 08:30 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 15:10 +0200
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:19 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:22 -0400
                Re: YADTR (Yet Another DateTime Rant) Rustom Mody <rustompmody@gmail.com> - 2014-03-28 06:30 -0700
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:32 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:20 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 16:34 +0200
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 14:35 +0000
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 02:25 +1100
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-26 16:33 -0700

csiph-web