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

Ben Finney ben+python at benfinney.id.au
Tue Sep 17 01:14:11 CEST 2013

Rob Cliffe <rob.cliffe at btinternet.com> writes:

> From the sublime to the, er ... plebeian?

When changing the subject of discussion, please change the Subject field

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

This would not be a good reason for *introducing* such a pair of modules
with confusingly-different APIs. But that's not the decision we face
today, many years after those modules entered the standard library.

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.

> I sometimes find myself spinning my wheels converting between a format
> supported by one and a format supported by the other.

That's a different matter, and does not challenge the continued
existence of separate ‘time’ and ‘datetime’ modules.

The ‘datetime’ module has grown functionality for working with the data
types of the ‘time’ module. What conversions are you lacking from the
current ‘datetime’ <URL:http://docs.python.org/3/library/datetime.html>?

 \         “Pinky, are you pondering what I'm pondering?” “I think so, |
  `\    Brain, but if the plural of mouse is mice, wouldn't the plural |
_o__)                      of spouse be spice?” —_Pinky and The Brain_ |
Ben Finney

More information about the Python-ideas mailing list