[Python-Dev] cpython: Introduce importlib.util.ModuleManager which is a context manager to
R. David Murray
rdmurray at bitdance.com
Wed May 29 17:58:21 CEST 2013
On Thu, 30 May 2013 00:59:02 +1000, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Thu, May 30, 2013 at 12:47 AM, Brett Cannon <brett at python.org> wrote:
> > I am willing to compromise to module_to_initialize, module_to_init, or
> > module_to_load. Pick one. =)
>
> I see this as *really* similar to a database transaction, and those
> start with "session.begin()".
>
> Could you tolerate "with begin_module_init(name) as m:"?
But for a transaction, it is 'with session', not 'with begin_session'.
With 'begin_module_init' I would have no idea what 'm' was. With
Brett's 'module_to_init' I have an intuitive idea about what 'm' is.
And if 'm' isn't a module, then module_manager would be better.
(Note that I haven't grokked what Brett's context manager is actually
doing/returning, I'm speaking here as an ignorant reader of someone
else's code :)
> We could even document the ability to check m.__initializing__ to see
> whether this is a reload() or not.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/rdmurray%40bitdance.com
More information about the Python-Dev
mailing list