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

References (1 earlier) <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 2014-11-24 19:36 +1100
Subject Re: unloading a module created with imp.new_module
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.16240.1416818193.18130.python-list@python.org> (permalink)

Show all headers | 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