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


Groups > comp.lang.python > #69144 > unrolled thread

Re: YADTR (Yet Another DateTime Rant)

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2014-03-26 10:53 +0100
Last post2014-03-27 11:09 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: YADTR (Yet Another DateTime Rant) Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-03-26 10:53 +0100
    Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 11:09 +0100

#69144 — Re: YADTR (Yet Another DateTime Rant)

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2014-03-26 10:53 +0100
SubjectRe: YADTR (Yet Another DateTime Rant)
Message-ID<mailman.8587.1395868967.18130.python-list@python.org>
----- Original Message -----
> One of my roles on this newsgroup is to periodically whine about
> stupidities in the Python datetime module.  This is one of those
> times.
> 
> I have some code which computes how long ago the sun set.  Being a
> nice
> pythonista, I'm using a timedelta to represent this value.  It would
> be
> difficult to imagine a less useful default way to print a timedelta:
> 
> previous sunset: -1 day, 22:25:26.295993
> 
> The idea of str() is that it's supposed to return a human-friendly
> representation of a value.  Humans do not say things like, "The sun
> set
> 1 day ago plus 22 hours and 25 minutes".

I can think of a less useful default way:

previous sunset: 1 sunset ago

This is how humans have been saying things for thousands of years before inventing the clock.
Beside that, I think datetime has all the formatters required to do pretty much anything.

Note : I don't see what's wrong in your example, however I have the feeling the term "stupiditie" is a little bit strong ;)

JM





-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[toc] | [next] | [standalone]


#69179

FromJohannes Bauer <dfnsonfsduifb@gmx.de>
Date2014-03-27 11:09 +0100
Message-ID<lh0tc6$bih$1@news.albasani.net>
In reply to#69144
On 26.03.2014 10:53, Jean-Michel Pichavant wrote:

> Note : I don't see what's wrong in your example, however I have the feeling the term "stupiditie" is a little bit strong ;)

The problem is that for a given timedelta t with t > 0 it is intuitive
to think that its string representation str(t) would follow the rule

"-" + str(t) == str(-t)

But it doesn't.

> -- IMPORTANT NOTICE: 
> 
> The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

I hereby inform you that I - probably by accident received your very
confidential and privileged message! All hardware has already been
thrown into the incinerator, is that good enough for you? Or do I have
to fulfill some ISO-9001 certified privileged mail destruction
procedure? Please advise on how I shall continue my life.

Cheers,
Johannes

IMPORTANT NOTICE:

If you write mails to newsgroups with a ridiculous confidentiality
footer, you are obliged under section 14.9a of the Imbecile Act to take
a blunt object of no less than 12 kg weight and hit yourself repeatedly
in the head until the email footer disappears. Failure to comply might
lead to criminal prosecution and/or permanent constipation! Thank you.


-- 
>> 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@speranza.aioe.org>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web