[issue7989] Add pure Python implementation of datetime module to CPython

R. David Murray report at bugs.python.org
Thu Jun 17 16:55:32 CEST 2010


R. David Murray <rdmurray at bitdance.com> added the comment:

I think we have no standard for this yet, though it has been discussed.  If you can't find a python-dev thread about it, you should probably start a new one.

As one example, heapq does:

  try:
      from _heapq import *
  except ImportError:
       pass

after having defined the python.  Which does not incur parsing overhead in most real-world situations since most distributions generate the .pyc files during install, but does incur the execution overhead on first import.

On the other hand, io doesn't fall back to _pyio at all (perhaps this is a bug).

As for the tests, the way this is typically done is that you define a base test class that is *not* a TestCase, and then you define two subclasses that are TestCases and mix in the base class.  You then assign the appropriate module (or function or whatever) under test as attributes of the subclasses, and the base class uses those attributes to run the tests.  That way you know all the tests are run for both the Python and the C implementation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7989>
_______________________________________


More information about the Python-bugs-list mailing list