Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.079 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'string': 0.09; 'negative.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'positive,': 0.16; 'str()': 0.16; 'subclass': 0.16; 'wrote:': 0.18; '(but': 0.19; 'thu,': 0.19; 'portion': 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; 'fixed': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '(although': 0.31; 'follows': 0.31; 'subject: (': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'positive': 0.37; 'pm,': 0.38; 'does': 0.39; 'days': 0.60; 'negative': 0.60; 'course': 0.61; 'simple': 0.61; 'hours': 0.66; 'mar': 0.68; 'yes': 0.68; 'legal': 0.71; 'prime': 0.74; 'day': 0.76; 'situations,': 0.84; 'to:none': 0.92; 'besides,': 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=IpYz16w4DyNmziZKwgT3KSXbxtEA5chUGU1PgLAwmDQ=; b=pHmmH+RTBXn0p9LII/8uMNtQk17xFeFLeZzYNzqjO3YC1nlSPk6583wH34Idp4n+At pify/7Aj8sqEk+OyXBfuHCN1MpZa9AbACX2rAgx16b3KjjdEe5PU24C3G0d0j/JsK15Q rMjoyXyA7YQP1Lo36juj1cytDjRGRCA0/FUpF70APZh1NXL5a9h0NB0UKncmcEMwuDdx 5REQZNLAvicdYzID90eVal11z6X8+376rL1DEuIlHB7faGO+xtOTjZqGdSdooETP/CCn ep5ChUd6mnfUPZlNwxgh1j3HJ6lFsVTcCVgNRTuPatSsVQ1i/PpnJ/tCiTBCjDAUbtMi SMGQ== MIME-Version: 1.0 X-Received: by 10.66.102.39 with SMTP id fl7mr1002904pab.43.1395917049494; Thu, 27 Mar 2014 03:44:09 -0700 (PDT) In-Reply-To: References: <53336df8$0$29994$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 27 Mar 2014 21:44:09 +1100 Subject: Re: YADTR (Yet Another DateTime Rant) From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395917059 news.xs4all.nl 2885 [2001:888:2000:d::a6]:54925 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69181 On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer 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. What you propose is completely arbitrary, and yes it WOULD be braindead to have str() return that (although of course this should be accepted as input). > 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. :) ChrisA