[Python-Dev] SF patch 864863: Bisect C implementation

Raymond Hettinger python at rcn.com
Thu Jan 1 02:53:55 EST 2004


[Skip Montanaro]
> > It would be nice to keep the old Python implementations around for
two
> > reasons.  First, there's the obvious educational value.  Second, the
> PyPy
> > folks will know where to find it when they need it.  I think a
Demo/Lib
> > subdirectory (with appropriate README) would be a reasonable place
to
> put
> > such code out to pasture.  It could be made available in source
> > distributions but never installed.

[Barry]
> The problem is that relegating stuff to Demo would very likely lead to
> bitrot, which is not a good thing.  Another advantage of having
current,
> working (and unit tested) pure-Python alternatives is that they are
much
> easier to modify if you're experimenting with new features, or bug
> fixes, etc.
> 
> OTOH, some of the really ancient Python modules will occasionally need
> attention to bring them up to modern coding standards, idioms, and
> practices.

There a several ways to go:

* have two visible modules like StringIO and cStringIO -- personally, I
see the approach as clutter but it makes it possible to unittest both.

* put the C module behind the scenes and import it into the python
module while leaving the old code conditionally excluded or just
commented out.

* if the code is short, move it to the docs -- the itertools module has
pure python equivalents in the docs -- that makes the code accessible
and makes the docs more informative -- this might work for bisect and
heapq where the amount of code is small.



Raymond


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



More information about the Python-Dev mailing list