Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81460
| Path | csiph.com!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'exec': 0.09; 'loaded,': 0.09; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '__del__': 0.16; 'dict': 0.16; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "module's": 0.16; 'subject:created': 0.16; 'substitute': 0.16; 'superfluous': 0.16; 'do,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'module': 0.19; 'result.': 0.19; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'am,': 0.29; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '25,': 0.31; 'subject:skip:i 10': 0.31; 'class': 0.32; 'this.': 0.32; 'quite': 0.32; 'could': 0.34; 'subject:with': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'doing': 0.36; 'method': 0.36; 'similar': 0.36; 'being': 0.38; 'nov': 0.38; 'that,': 0.38; 'itself': 0.39; 'ian': 0.60; 'most': 0.60; 'strictly': 0.61; "you're": 0.61; "you'll": 0.62; 'beside': 0.84; 'stronger': 0.84; 'to:none': 0.92; 'comfort': 0.96 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=z4d4sYXxaTPtCC6P10bQgIz98cwyr0lPhI0tUSMCWIg=; b=G/R+rNFZwNKJkRKpE8bt0PQDr9S7s3YbN3p5vD3GTvGoC3yGbUGjj7JfFFGPjIkgKS CwdYD7KjYxhqhEfVWE3k48YqXgHjNvIZIf5L0jo/Jl1lwuv5Bs3WroqK32Ll+M8sfOWr AAP2tdJYqVPPOwHeIQQ6zRsFlUnMbScBNIB4QeP5zfy98jxo01JWF9HSlghne/gYkpFj dFsEf7t84BXGRonb8mTbkkZ7WyWi6rEJ37Y3XkNbdczpnJNoamx6yWmsbHaaTVgCPzvF 0nsvmdoZpFF0Wt2AptZUkMdveOiKH7/NBZ9whmsvMaPW+6X3pCctD4RLWhjbq8djoRIS FvvA== |
| MIME-Version | 1.0 |
| X-Received | by 10.42.130.194 with SMTP id w2mr1341972ics.12.1416842435215; Mon, 24 Nov 2014 07:20:35 -0800 (PST) |
| In-Reply-To | <CALwzidkBHaBVGcY-xdRXTbpEajnHxz+bsqO0EqMbdZhDuASMPA@mail.gmail.com> |
| References | <C093BC09-3AB7-49DB-B160-265A34C6BCDA@gmail.com> <CALwzidnHV8smFHtvixtdhX-i94PWbwNKSRrR6HAfhn2HOKqxsw@mail.gmail.com> <CALwzid=9Zgu3svDP-mv8-1DrZkKkDcNTxy+D=obwGsOGzB5aZQ@mail.gmail.com> <B8391E6B-5AA4-4125-96BC-74B12B46E927@gmail.com> <CALwzidkgysWb0o=NG-McQpss+7B1o2AsECMzio=75eCxDuh_HQ@mail.gmail.com> <6E80C5B3-4203-4CA5-9796-175DB9567862@gmail.com> <CALwzidkBHaBVGcY-xdRXTbpEajnHxz+bsqO0EqMbdZhDuASMPA@mail.gmail.com> |
| Date | Tue, 25 Nov 2014 02:20:35 +1100 |
| Subject | Re: unloading a module created with imp.new_module |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16252.1416842444.18130.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416842444 news.xs4all.nl 2855 [2001:888:2000:d::a6]:44094 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81460 |
Show key headers only | View raw
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: unloading a module created with imp.new_module Chris Angelico <rosuav@gmail.com> - 2014-11-25 02:20 +1100
csiph-web