[Python-Dev] Pre-PEP: Redesigning extension modules

Benjamin Peterson benjamin at python.org
Sat Aug 24 21:17:15 CEST 2013


2013/8/24 Terry Reedy <tjreedy at udel.edu>:
> On 8/24/2013 8:51 AM, Stefan Behnel wrote:
>>
>> Antoine Pitrou, 24.08.2013 13:53:
>>>
>>> This would also imply extension module have to be subclasses of the
>>> built-in module type. They can't be arbitrary objects like Stefan
>>> proposed. I'm not sure what the latter enables, but it would probably
>>> make things more difficult internally.
>>
>>
>> My line of thought was more like: if Python code can stick anything into
>> sys.modules and the runtime doesn't care, why can't extension modules
>> stick
>> anything into sys.modules as well?
>
>
> Being able to stick anything in sys.modules in CPython is an implementation
> artifact rather than language feature.

This is not really true. Many people use this feature to replace
modules as they are being imported with other things.

-- 
Regards,
Benjamin


More information about the Python-Dev mailing list