Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81490
| References | (3 earlier) <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> <0ECF213F-5ADC-493F-99E2-453443E2C901@gmail.com> |
|---|---|
| Date | 2014-11-25 17:51 +1100 |
| Subject | Re: unloading a module created with imp.new_module |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16268.1416898271.18130.python-list@python.org> (permalink) |
On Tue, Nov 25, 2014 at 5:48 PM, Patrick Stinson <patrickkidd@gmail.com> wrote:
> Is it still possible to import non-module objects? I guess this question is
> just for fun now :)
rosuav@sikorsky:~$ python3
Python 3.5.0a0 (default:23ab1197df0b, Nov 20 2014, 12:57:44)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules["hello"]=lambda s: print("Hello, %s!"%s)
>>> import hello
>>> hello("world")
Hello, world!
>>>
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 17:51 +1100
csiph-web