Author r.david.murray
Recipients amaury.forgeotdarc, belopolsky, brett.cannon, brian.curtin, daniel.urban, lemburg, pitrou, r.david.murray, techtonik, vstinner
Date 2010-06-17.14:55:29
SpamBayes Score 1.80229e-06
Marked as misclassified No
Message-id <1276786532.31.0.995437745416.issue7989@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-06-17 14:55:32r.david.murraysetrecipients: + r.david.murray, lemburg, brett.cannon, amaury.forgeotdarc, belopolsky, pitrou, vstinner, techtonik, brian.curtin, daniel.urban
2010-06-17 14:55:32r.david.murraysetmessageid: <1276786532.31.0.995437745416.issue7989@psf.upfronthosting.co.za>
2010-06-17 14:55:30r.david.murraylinkissue7989 messages
2010-06-17 14:55:30r.david.murraycreate