avoid import short-circuiting

Discussion in 'Python' started by Andrea Crotti, Mar 16, 2012.

  1. 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
     
    Andrea Crotti, Mar 16, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pho Bo Vien

    Short circuiting validation controls

    Pho Bo Vien, Apr 28, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    376
  2. ram

    Short circuiting..

    ram, Apr 3, 2004, in forum: C Programming
    Replies:
    3
    Views:
    432
  3. Dave Opstad
    Replies:
    16
    Views:
    465
    Duncan Booth
    Mar 11, 2005
  4. kj
    Replies:
    11
    Views:
    475
    Jean-Michel Pichavant
    Mar 23, 2010
  5. Billy Mays

    Short-circuiting in C

    Billy Mays, May 26, 2011, in forum: C Programming
    Replies:
    63
    Views:
    1,667
    88888 Dihedral
    Aug 28, 2012
Loading...

Share This Page