On Jan 31, 2013 5:50 PM, "Nick Coghlan" <ncoghlan@gmail.com> wrote:
> On Fri, Feb 1, 2013 at 5:56 AM, Eric Snow <ericsnowcurrently@gmail.com> wrote:
> > That said, Larry's original proposal relates to sys, a built-in module
> > written in C (in CPython of course).  In that case the solution is not
> > quite the same, since module initialization interacts with sys.modules
> > differently. [1][2]  Accommodating the original request would require
> > more work, whether to muck with the import C-API or making sys an
> > instance of another type, as someone suggested.
> sys is already special cased so heavily in the interpreter
> initialization, making it a little more special really wouldn't bother
> me much :)
> As far as customising other extension modules goes, the same "replace
> yourself in sys.modules" trick should still work, you'd just do it via
> the C API from your module init function.

Don't extension modules get added to sys.modules only after their init function returns?