Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44280

Re: improvements sought re. logging across modules

Date 2013-04-24 13:55 -0400
From Dave Angel <davea@davea.name>
Subject Re: improvements sought re. logging across modules
References <D9OdncANCNCqk-XMnZ2dnUVZ8sOdnZ2d@brightview.co.uk>
Newsgroups comp.lang.python
Message-ID <mailman.1027.1366826130.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

improvements sought re. logging across modules The Night Tripper <jkn+gg@nicorp.co.uk> - 2013-04-24 17:54 +0100
  Re: improvements sought re. logging across modules Fábio Santos <fabiosantosart@gmail.com> - 2013-04-24 18:29 +0100
  Re: improvements sought re. logging across modules Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-04-24 19:43 +0200
  Re: improvements sought re. logging across modules Dave Angel <davea@davea.name> - 2013-04-24 13:55 -0400

csiph-web