Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21767
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!news2.arglkargh.de!easy.in-chemnitz.de!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'infinite': 0.07; 'mess': 0.07; 'called.': 0.09; 'myself,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'underlying': 0.09; 'url:github': 0.09; 'anymore.': 0.16; 'enigma': 0.16; 'kern': 0.16; 'subject:import': 0.16; 'examples': 0.16; 'wrote:': 0.18; 'this?': 0.19; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'guess': 0.26; 'module': 0.26; 'skip:_ 20': 0.26; 'import': 0.27; 'tried': 0.27; 'depends': 0.28; 'interpret': 0.29; 'problem': 0.29; 'pm,': 0.29; 'imported': 0.30; 'quite': 0.31; 'instead.': 0.32; 'there': 0.33; 'header:User- Agent:1': 0.33; 'too': 0.33; 'header:X-Complaints-To:1': 0.34; 'loop': 0.34; 'to:addr:python-list': 0.35; 'received:org': 0.36; 'but': 0.37; 'using': 0.37; 'could': 0.38; 'should': 0.38; 'might': 0.40; 'to:addr:python.org': 0.40; 'easy': 0.60; 'achieve': 0.61; 'world': 0.61; 'received:86': 0.63; 'our': 0.63; 'believe': 0.65; 'andrea': 0.84; 'hook': 0.84; 'eco': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: avoid import short-circuiting |
| Date | Fri, 16 Mar 2012 17:19:47 +0000 |
| References | <4F636F0D.3060006@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host86-147-15-181.range86-147.btcentralplus.com |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
| In-Reply-To | <4F636F0D.3060006@gmail.com> |
| 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.729.1331918404.3037.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1331918404 news.xs4all.nl 6867 [2001:888:2000:d::a6]:45061 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21767 |
Show key headers only | View raw
On 3/16/12 4:49 PM, Andrea Crotti wrote: > I started the following small project: > > https://github.com/AndreaCrotti/import-tree > > because I would like to find out what exactly depends on what at run-time, using > an import hook. > > It works quite well for small examples but the main problem is that once a > module is imported > it's added to sys.modules and then it doesn't go through the import hook anymore. > > I tried to mess around with sys.modules but it might not be a good idea, and it > leads to easy > infinite loops. > Is there a good way to achieve this? > I guess I could do the loop detection myself, but that should not be too hard.. You want to monkeypatch __builtin__.__import__() instead. It always gets called. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: avoid import short-circuiting Robert Kern <robert.kern@gmail.com> - 2012-03-16 17:19 +0000
csiph-web