Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81460 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2014-11-25 02:20 +1100 |
| Last post | 2014-11-25 02:20 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: unloading a module created with imp.new_module Chris Angelico <rosuav@gmail.com> - 2014-11-25 02:20 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-11-25 02:20 +1100 |
| Subject | Re: unloading a module created with imp.new_module |
| Message-ID | <mailman.16252.1416842444.18130.python-list@python.org> |
On Tue, Nov 25, 2014 at 2:12 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: >> Crazy. Is there any other way to comfort when a module is being deleted >> beside defining a class object with a printing dtor? > > Modules don't strictly have to be ModuleType. You could substitute a class > with a __del__ method for the module itself for testing this. And based on the original description of exec'ing code into the module's dictionary, the module is actually quite superfluous - just exec the code into an empty dict and you'll get a similar result. Though if you're doing a lot with code reloading, you may want to consider a language with stronger support for it, like Pike. Python can do it, but it's not really something most people do, so the language and stdlib are generally built on the assumption that, once loaded, code stays loaded. ChrisA
Back to top | Article view | comp.lang.python
csiph-web