[Python-ideas] Continued support for ‘time’ and ‘datetime’ modules (was: Reduce platform dependence of date and time related functions)

Steven D'Aprano steve at pearwood.info
Tue Sep 17 01:24:44 CEST 2013


On Tue, Sep 17, 2013 at 09:14:11AM +1000, Ben Finney wrote:
> Rob Cliffe <rob.cliffe at btinternet.com> writes:

> > Just an idea for Python 4: Is there any good reason to have separate
> > time and datetime modules?
> 
> That's how it's been for a long time. There is now a lot of existing
> Python code that uses those two modules as they are.
[...]
> Changes to the standard library API, especially for modules that are in
> long-established use, must be considered conservatively. And that *is* a
> good reason to continue having ‘time’ and ‘datetime’ modules which both
> support the existing behaviour.

Agreed.

But I suggest to Rob, or anyone else who likes the idea of merging the 
two modules and is willing to do the work, to start off by creating an 
interface module that wraps the two. Call it (for lack of a better name) 
"mytime". When the "mytime" module is sufficiently mature, which may 
require publishing it on PyPI for the public to use, it could 
potentially be added to the standard library as a high level interface 
to the lower-level time and datetime modules.

That doesn't need to wait for Python 4000.

I'm +0 on the general idea. I don't use either module enough to be 
annoyed by there being two of them. (Three if you include calendar.)


-- 
Steven


More information about the Python-ideas mailing list