Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > avoid import short-circuiting

Reply
Thread Tools

avoid import short-circuiting

 
 
Andrea Crotti
Guest
Posts: n/a
 
      03-16-2012
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..

Thanks,
Andrea
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid having a SQL express for web parts and avoid personalization Roger23 ASP .Net 2 10-12-2006 10:54 PM
to use import java.lang.* or import java.lang.Math or none at all? JPractitioner Java 13 02-24-2006 08:48 PM
Question about namespaces and import. How to avoid calling os.system Pekka Niiranen Python 5 07-23-2005 05:08 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM
Avoid wasting time or how to avoid initialization Alexander Malkis C++ 8 04-13-2004 11:23 PM



Advertisments