[Python-ideas] re-organizing the sys module

Nick Coghlan ncoghlan at gmail.com
Thu Mar 13 10:29:09 CET 2014


On 13 March 2014 17:43, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> At the moment I'm not proposing any big changes to sys nor any changes
> at all to its API.  That can come later. <wink>  Instead, this
> proposal is about setting the stage for better flexibility in making
> changes to sys when the need arises.  Consequently I propose just
> 2.5000000000000001 relatively simple changes:
>
> 1. the existing sys module be renamed to _sys (and the stdlib be
> changed accordingly where appropriate);
> 2. a pure Python sys module be added to the stdlib that wraps the existing API;

As Antoine suggests, we shouldn't do that until we have a concrete use
case (although I'm generally approving of the idea, there are also
benefits to having it as entirely a builtin module).

It may seem counterintuitive, but it's actually easier to sell
non-invasive prep work after already making the case for the
subsequent change :)

> 2.5. the new module should use the replace-itself-in-sys.modules
> technique to provide a module subclass that supports descriptors.

I'm generally against doing that without a clear rationale for why
defining a new object to use isn't more appropriate (we've survived
attribute -> function transitions before, like the one to using the
thread safe sys.exc_info()).

Cheers,
Nick.

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


More information about the Python-ideas mailing list