improvements sought re. logging across modules

Dave Angel davea at davea.name
Wed Apr 24 13:55:12 EDT 2013


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



More information about the Python-list mailing list