[Python-ideas] PEP 4XX: Adding sys.implementation

Eric Snow ericsnowcurrently at gmail.com
Tue May 1 05:47:51 CEST 2012


On Mon, Apr 30, 2012 at 9:08 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, May 1, 2012 at 12:50 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
>> In my mind sys.implementation makes more sense.  For example, in the
>> case of cache_tag (which is merely a potential future variable), its
>> value is an implementation detail used by importlib.  Having it in
>> sys.implementation would emphasize this point.
>
> Personally, I think cache_tag should be part of the initial proposal.
> Implementations may want to use different cache tags depending on
> additional information that importlib shouldn't need to care about,
> and I think it would also be reasonable to allow "cache_tag=None" to
> disable the implicit caching altogether.

Agreed.  This is how I was thinking of it.  I just wanted to keep
things as minimal as possible to start.  In importlib we can fall back
to name+version if cache_tag isn't there.  Still, of the potential
variables, cache_tag is the strongest candidate, having a solid (if
optional) use-case right now.

> The ultimate goal would be for us to be able to eliminate
> implementation checks from other parts of the standard library.
> importlib is a good place to start, since the idea is that, aside from
> the mechanism used to bootstrap it into place, along with optional
> acceleration of __import__, importlib itself should be implementation
> independent.

Spot on!

-eric



More information about the Python-ideas mailing list