[Python-ideas] Rename time module to "posixtime"

M.-A. Lemburg mal at egenix.com
Tue Jun 15 10:07:27 CEST 2010


Alexander Belopolsky wrote:
> One of the common complains about working with time values in Python,
> is that it some functionality is available in time module, some in
> datetime module and some in both.
> 
> I propose a series of steps towards improving this situation.
> 
> 1. Create posixtime.py initially containing just  "from time import *"
> 2. Add python implementation of time.* functions to posixtime.py.
> 3. Rename time module to _posixtime and add time.py with a deprecation
> warning and "from _posixtime import *".
> 
> Note that #2 may require to move some code from timemodule.c to
> datetimemodule.c, but at the binary level code compiled from these
> files is already linked together in datetimemodule.  Moving the
> necessary code to datetime.c will help to eliminate current circular
> dependency between time and datetime.

I'm not sure I understand the point in renaming the module.

Note that the time module works based on Unix ticks (seconds
since the Unix Epoch), while the datetime module works based
on its own set of types.

As such, the two are different implementations for managing
date/time. Mixing them won't make things easier to understand.
The time module is very close to the C lib API, while the datetime
module focuses more on date/time storage in a more accessible.

I agree on one point, though: the shared C APIs for getting the
current time would be better put into a separate C extension
which both can then load without creating circular references,
e.g. _getcurrenttime.c.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 15 2010)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2010-07-19: EuroPython 2010, Birmingham, UK                33 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the Python-ideas mailing list