Marc-Andre Lemburg <m...@egenix.com> added the comment: > I believe _time module should become the home of the gettimeofday() method > and pure python implementation of time.time() will be > > def time() > s, us = _time.gettimeofday() > return s + 1e-6 * us > > > Similarly time.sleep() can be implemented in terms of lower level POSIX > nanosleep() method. > > Lower level localtime() function can provide access to tm_zone and tm_gmtoff > members of struct tm (where available) without concerns about backward > compatibility.
Just for understanding: Why are you calling the ticket "*Add* pure Python implementation of time module to CPython" when you appear to be after *replacing* the C implementation of the time module with a Python version ? The same argument as for the datetime module applies: you can *add* a compatible Python version of the same module for other Python implementations to use, but undoing the work that has been done in order to provide a faster implementation of the Python version is a no-go. Both datetime and time module functionalities need to be as fast as possible, since they are used a lot in Python code. That was the main reason for having a C implementation of the datetime and time modules. Python C function calls are still a lot faster than Python function calls. You can't just replace a C function call with a Python one without taking this into account. For these modules, it's not just the API compatibility that matters, performance is just as relevant and I don't really see a point in making CPython slower just to make maintenance of stdlib modules that are not needed by CPython easier. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9528> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com