Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python3': 0.07; 'sys': 0.07; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'objects?': 0.16; 'subject:created': 0.16; 'world!': 0.16; 'wrote:': 0.18; 'patrick': 0.19; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'question': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '25,': 0.31; 'subject:skip:i 10': 0.31; 'linux': 0.33; 'guess': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'nov': 0.38; 'pm,': 0.38; 'more': 0.64; '2014,': 0.84; 'to:none': 0.92 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=Bdh6KRNWuwvBdf6LRRxGtp+mE1PE0PyiAZLP91EsK7U=; b=Bty4Eu0gNIe3C3nCxzq+qXj6OrxmIpn/dUDsM5ESGnf7BK2qczcn6APtJ9veNOvBVJ 6dMXW6PMcIlvJaXyC8TS/zsw+CRcXO3ubQ2W+HGYLz1twA58f+zvC69WepFcSRvE4xmX v/iZ0BHD8P6H2kvGjApu3MLj2OcgGNmQNmwDQbVntllimCb8PHbEVR06KxDX7kodlGZj 7lzzbW07LkWgYTvVtovGTzY4meloN9FvdoppqFNZj31soDd/K3Rq2oe9lFYF+XPLjKrA ZQEftCxRJWsPjSvL99UQAb6HOvQIdcgbJa9BtArRbsno7K2bgiSp4vlbciUj+V2SfvxO Barg== MIME-Version: 1.0 X-Received: by 10.107.17.79 with SMTP id z76mr21959047ioi.27.1416898268703; Mon, 24 Nov 2014 22:51:08 -0800 (PST) In-Reply-To: <0ECF213F-5ADC-493F-99E2-453443E2C901@gmail.com> References: <6E80C5B3-4203-4CA5-9796-175DB9567862@gmail.com> <0ECF213F-5ADC-493F-99E2-453443E2C901@gmail.com> Date: Tue, 25 Nov 2014 17:51:08 +1100 Subject: Re: unloading a module created with imp.new_module From: Chris Angelico Cc: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416898271 news.xs4all.nl 2829 [2001:888:2000:d::a6]:47612 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3882 X-Received-Body-CRC: 3856234158 Xref: csiph.com comp.lang.python:81490 On Tue, Nov 25, 2014 at 5:48 PM, Patrick Stinson 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