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: 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: <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 Cc: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Mon, Nov 24, 2014 at 6:27 PM, Patrick Stinson wr= ote: > How does the __del__ method have a reference to the module=E2=80=99s glob= als 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