A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-May/126601.html below:

[Python-Dev] cpython: Introduce importlib.util.ModuleManager which is a context manager to

[Python-Dev] cpython: Introduce importlib.util.ModuleManager which is a context manager to [Python-Dev] cpython: Introduce importlib.util.ModuleManager which is a context manager toBrett Cannon brett at python.org
Wed May 29 02:14:41 CEST 2013
On Tue, May 28, 2013 at 5:40 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Tue, 28 May 2013 23:29:46 +0200 (CEST)
> brett.cannon <python-checkins at python.org> wrote:
>>
>> +.. class:: ModuleManager(name)
>> +
>> +    A :term:`context manager` which provides the module to load. The module will
>> +    either come from :attr:`sys.modules` in the case of reloading or a fresh
>> +    module if loading a new module. Proper cleanup of :attr:`sys.modules` occurs
>> +    if the module was new and an exception was raised.
>
> What use case does this API solve?

See http://bugs.python.org/issue18088 for the other part of this
story. I'm basically replacing what importlib.util.module_for_loader
does after I realized there is no way in a subclass to override
what/how attributes are set on a module before the code object is
executed. Instead of using the decorator people will be able to use
this context manager with a new method to get the same effect with the
ability to better control attribute initialization.

> (FWIW, I think "ModuleManager" is a rather bad name :-)

I'm open to suggestions, but the thing does manage the module so it at
least makes sense.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4