[Python-Dev] Issue 2736: datetimes and Unix timestamps (original) (raw)

Walter Dörwald walter at livinglogic.de
Tue Jun 5 10:36:42 CEST 2012


On 04.06.12 13:19, Dirkjan Ochtman wrote:

I recently opened issue14908. At work, I have to do a bunch of things with dates, times and timezones, and sometimes Unix timestamps are also involved (largely for easy compatibility with legacy APIs). I find the relative obscurity when converting datetimes to timestamps rather painful; IMO it should be possible to do everything I need straight from the datetime module objects, instead of having to involve the time or calendar modules.

Anyway, I was pointed to issue 2736, which seems to have got a lot of discouraged core contributors (Victor, Antoine, David and Ka-Ping, to name just a few) up against Alexander (the datetime maintainer, AFAIK).

Also see: http://bugs.python.org/issue665194 (datetime-RFC2822 roundtripping)

It seems like a fairly straightforward case of practicality over purity: Alexander argues that there are "easy" one-liners to do things like datetime.totimestamp(),

I don't want one-liners, I want one-callers! ;)

but most other people seem to not find them so easy. They've since been added to the documentation at least, but I would like to see if there is consensus on python-dev that adding a little more timestamp support to datetime objects would make sense.

Servus, Walter



More information about the Python-Dev mailing list