[Python-ideas] Additional datetime-like module

Andrew Barnert abarnert at yahoo.com
Wed Jul 29 11:52:23 CEST 2015


On Jul 29, 2015, at 06:48, Lennart Regebro <regebro at gmail.com> wrote:
> 
> On Wed, Jul 29, 2015 at 6:42 AM, Matthias Bussonnier
> <bussonniermatthias at gmail.com> wrote:
>> Hi,
>> 
>> For whatever reason that make me strangely think of bytes vs unicode strings…
>> Where you just s/simple case/str/s ; s/robust case/unicode/g and
>> s/timezone/encoding/g
>> 
>> Than being said, a new module might allow more flexibility in playing
>> with the API, like in Delorean[1] for example.
> 
> Two datetime modules with different API is definitely not a good idea.
> I do think a new module is necessary, but it should completely replace
> not just datetime, but also time. Maybe even calendar. There is
> overlap (and some cruft) between these modules, and it can be hard to
> understand exactly what function to use when, etc.

That's not a bad idea. (Assuming you mean a very long-term deprecation or just "you probably shouldn't use this in new code, and it may be deprecated one of these decades" a la asyncore.) That would mean we get a sleep function, timing functions, etc. that take and return timedeltas instead of second or millis floats or ints, etc. You might want to go even farther and use datetime and timedelta objects in things like file times. It's a pretty big change, with a lot of backward compat risk, but the end result could be a much nicer stdlib.


More information about the Python-ideas mailing list