YADTR (Yet Another DateTime Rant)

Johannes Bauer dfnsonfsduifb at gmx.de
Thu Mar 27 12:05:09 CET 2014


On 27.03.2014 11:44, Chris Angelico wrote:
> On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer <dfnsonfsduifb at 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. 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.

>> 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!

Cheers,
Johannes

-- 
>> Wo hattest Du das Beben nochmal GENAU vorhergesagt?
> Zumindest nicht öffentlich!
Ah, der neueste und bis heute genialste Streich unsere großen
Kosmologen: Die Geheim-Vorhersage.
 - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1 at speranza.aioe.org>



More information about the Python-list mailing list