[Python-ideas] Extend module objects to support properties

Nick Coghlan ncoghlan at gmail.com
Fri Feb 1 01:50:03 CET 2013


On Fri, Feb 1, 2013 at 5:56 AM, Eric Snow <ericsnowcurrently at 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.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list