Re: improvements sought re. logging across modules

Discussion in 'Python' started by Dave Angel, Apr 24, 2013.

  1. Dave Angel

    Dave Angel Guest

    On 04/24/2013 12:54 PM, The Night Tripper wrote:
    > Hi all
    > I have a small suite of python modules, say
    >
    > A.py
    > B.py
    > C.py
    >
    > which can be invoked in a variety of ways. eg.
    >
    > 1) A.py is invoked directly; this imports and uses B.py and C.py
    >
    > 2) B.py is invoked; this imports and uses A.py and C.py
    >


    Right there you have a potential problem. Unless you make those imports
    conditional, you have an import loop, which can be a minor problem, or a
    big one.

    Whenever you find loops in the import call tree, please break them. The
    best way is to move the interdependencies into yet another module, and
    let both A and B import that one.



    --
    DaveA
    Dave Angel, Apr 24, 2013
    #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. Rotem
    Replies:
    23
    Views:
    597
    Trent Mick
    Sep 15, 2005
  2. Matthew Wilson
    Replies:
    2
    Views:
    255
    Martin v. Loewis
    May 11, 2010
  3. Jason Friedman
    Replies:
    0
    Views:
    146
    Jason Friedman
    Feb 3, 2012
  4. Fábio Santos
    Replies:
    0
    Views:
    71
    Fábio Santos
    Apr 24, 2013
  5. Chris “Kwpolska†Warrick

    Re: improvements sought re. logging across modules

    Chris “Kwpolska†Warrick, Apr 24, 2013, in forum: Python
    Replies:
    0
    Views:
    70
    Chris “Kwpolska†Warrick
    Apr 24, 2013
Loading...

Share This Page