[Distutils] Fixing the stdlib

Ian Bicking ianb at colorstudy.com
Sat Aug 27 21:26:55 CEST 2005


Vaguely off-topic, but I figured someone here might know...

Anyway, I want to provide backported stdlib modules to older versions of 
Python.  Most of these are trivial to backport, so it's just a matter of 
accumulating them in one place.

So I'm wondering how best I should put this in place.  One way would be 
to import the backported modules, then modify sys.modules.  But this 
requires importing everything ahead of time, which is no good.  At the 
same time, I'd rather have the process Instantly Seem Upgraded (assuming 
the program isn't using any language features not supported by the 
process).  I could actually distribute something that included the 
top-level modules; this would work for something like optparse or 
subprocess, where the module simply didn't exist before.  But this 
doesn't work when providing updated modules that existed before but have 
been enhanced, like doctest.

I'm also not sure when I should monkeypatch the existing module, or 
provide a new one.  For instance, tempfile added a couple functions in 
2.4, and UserDict added a useful class (DictMixin).

Thoughts?

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org


More information about the Distutils-SIG mailing list