[Python-ideas] a standard approach to module-replace-itself-in-sys.modules

Eric Snow ericsnowcurrently at gmail.com
Fri Mar 14 03:53:52 CET 2014


On Mar 13, 2014 6:54 AM, "Brett Cannon" <brett at python.org> wrote:
> Do we actually want to promote this practice by codifying support for it
in the stdlib?

I guess I was expecting that question from you. :)  I figure if the
practice is officially supported then we should help folks doing it to not
shoot themselves in the foot.  As to how much such a tool will promote the
practice, I'm not sure that it will, particularly if the helper is located
out of the way.  However I'm sure you've watched similar additions unfold
and have a better sense of that than I do.

> If you're doing this to get decorators for module attributes then you
should say this is for that goal and the solution is getting the module
swapping hack to be easier to use (and might call for a better solution).
Otherwise this proposal feels like it's trying to codify behaviour that is
rarely necessary.

Agreed.  Furthermore I doubt I'll push on this idea without a strong need
first.  More than anything I wanted to share what seemed like an elegant
solution to the "problem", even if we don't need to solve it right away.
If I get more serious about it I'll hit up folks that are using the current
hack (Django?) and see if it improves anything for them.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140313/0fcb4c2b/attachment.html>


More information about the Python-ideas mailing list