Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81446

Re: unloading a module created with imp.new_module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; '24,': 0.16; '__del__': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function?': 0.16; 'globals': 0.16; 'modules.': 0.16; 'subject:created': 0.16; 'wrote:': 0.18; 'module': 0.19; 'patrick': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'references': 0.26; 'header:In- Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'subject:skip:i 10': 0.31; 'class': 0.32; 'subject:with': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'method': 0.36; 'being': 0.38; 'nov': 0.38; 'pm,': 0.38; 'does': 0.39; 'use.': 0.39; 'how': 0.40; 'beside': 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:content-transfer-encoding; bh=k54PiNUyO8WSO2/EH/dsPR5SRPB2aFN6ew43ms+VRDg=; b=K13jPZ8b8LISA4pbJgu1xJSof9GLk6Vet0lHWT/CD1Ypitft1Z8JaDGrQBbOdq0410 6MaR9H3JICDUt0I/e8TrZ3uyHoHgTH2VAyIVzb8h6pAjdMNLq96oCpqhnnb4JVGK31qE p8lpP/GfmvaYVSFGiRQ3CjTV8S6YEnBV9QtVAUf6UNUCn9uQ5nDoPk7U1VGCe7LpA2bH 8PjIDcEcWSGUqdXS5+ONZ/3g9O0/zNLo8ck6ZfM5IRAZjCbfx/8/fLBxc0g2c2PPUasL bvj4K2P8va6V6a1WiVR9XmMiEAn9J6R02zXBI52LZSxXezBgTnBODBSoSg+bjqX8y+2k jQuw==
MIME-Version 1.0
X-Received by 10.42.110.195 with SMTP id r3mr23356127icp.12.1416818191360; Mon, 24 Nov 2014 00:36:31 -0800 (PST)
In-Reply-To <6E80C5B3-4203-4CA5-9796-175DB9567862@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>
Date Mon, 24 Nov 2014 19:36:31 +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
Content-Transfer-Encoding quoted-printable
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.16240.1416818193.18130.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416818193 news.xs4all.nl 2945 [2001:888:2000:d::a6]:45017
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81446

Show key headers only | View raw


On Mon, Nov 24, 2014 at 6:27 PM, Patrick Stinson <patrickkidd@gmail.com> wrote:
> How does the __del__ method have a reference to the module’s globals dict?
> because it references the print function?
>
> Crazy. Is there any other way to comfort when a module is being deleted
> beside defining a class object with a printing dtor?

Functions have references to their modules. That's how they know what
globals to use.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: unloading a module created with imp.new_module Chris Angelico <rosuav@gmail.com> - 2014-11-24 19:36 +1100

csiph-web