Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2205
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'sys': 0.04; 'foo': 0.09; 'namespace': 0.09; 'pm,': 0.11; '>>>': 0.12; 'wrote:': 0.14; '-tkc': 0.16; '999': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'monkeys': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'subject:delete': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'variable': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:addr :python-list': 0.22; 'modification': 0.23; 'module,': 0.23; 'changes': 0.29; 'cc:addr:python.org': 0.31; "skip:' 10": 0.32; 'import': 0.32; 'module': 0.33; 'received:70': 0.34; 'there': 0.35; 'header:User-Agent:1': 0.35; 'references': 0.38; 'delete': 0.38; 'how': 0.39; 'banner': 0.80; 'beware': 0.84 |
| Date | Tue, 29 Mar 2011 20:41:28 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
| MIME-Version | 1.0 |
| To | monkeys paw <monkey@joemoney.net> |
| Subject | Re: delete namespaces |
| References | <UtydnQbv7-6IGQ_QnZ2dnUVZ_hWdnZ2d@insightbb.com> |
| In-Reply-To | <UtydnQbv7-6IGQ_QnZ2dnUVZ_hWdnZ2d@insightbb.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4.1301449303.2990.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1301449303 news.xs4all.nl 34849 [::ffff:82.94.164.166]:51826 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2205 |
Show key headers only | View raw
On 03/29/2011 08:14 PM, monkeys paw wrote:
> How do i delete a module namespace once it has been imported?
>
> I use
>
> import banner
>
> Then i make a modification to banner.py. When i import it again,
> the new changes are not reflected. Is there a global variable i can
> modify?
Delete it from sys.modules:
>>> file('foo.py', 'w').write('x = 42\n')
>>> import foo
>>> foo.x
42
>>> del foo
>>> import sys
>>> del sys.modules['foo']
>>> file('foo.py', 'w').write('x = 999\n')
>>> import foo
>>> foo.x
999
Beware that if you still have old references to the module, they
don't get refreshed.
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
delete namespaces monkeys paw <monkey@joemoney.net> - 2011-03-29 21:14 -0400
Re: delete namespaces Raymond Hettinger <python@rcn.com> - 2011-03-29 18:32 -0700
Re: delete namespaces Tim Chase <python.list@tim.thechases.com> - 2011-03-29 20:41 -0500
Re: delete namespaces Terry Reedy <tjreedy@udel.edu> - 2011-03-30 00:57 -0400
Re: delete namespaces Raymond Hettinger <python@rcn.com> - 2011-03-30 17:11 -0700
Re: delete namespaces Chris Angelico <rosuav@gmail.com> - 2011-03-31 14:06 +1100
Re: delete namespaces Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-03-30 11:10 +0200
Re: delete namespaces Terry Reedy <tjreedy@udel.edu> - 2011-03-30 15:03 -0400
Re: delete namespaces Tim Golden <mail@timgolden.me.uk> - 2011-03-30 20:08 +0100
Re: delete namespaces Ritesh Nadhani <riteshn@gmail.com> - 2011-03-30 21:22 -0700
Re: delete namespaces rusi <rustompmody@gmail.com> - 2011-03-30 22:11 -0700
csiph-web