On Oct 7, 5:22 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > MarkyMarc wrote: > > On Oct 7, 4:24 pm, Bruno Desthuilliers <bruno. > > [EMAIL PROTECTED]> wrote: > >> MarkyMarc a écrit : > >> import is a statement. It's executed, like any other top-level code, > >> when the module is imported (or the script loaded into the interpreter > >> if it's called directly). So if A.py imports B.py and B.py imports A.py, > >> you do have a circular reference that can't be solved. > > >> Anyway, circular dependencies are Bad(tm), so you *don't* want such a > >> situation. > > > Yes it is bad and I would not do it in production. But shouldn't I be > > able to call one module from another module inside a package? > > Thats not the point. Intra-package references are (of course) perfectly > possible, the problem here are *circular* references (as Bruno explained). > > Secondly, if you have such circular dependencies, I would argue that > your package design might need a little reconsideration. Why do 2 > seperate modules need *each other*? To me that sounds like 2 modules > begging to be combined. > > /W
It was simply to make a point. But then lets say the to files looks like this: ******************************* atest.py: def printA(): print "This is Atest from Apack" ******************************* btest.py: from Test.apack import atest def printB(): print "This is Btest from Bpack" def printatest(): print atest.printA() print printB() print printatest() ******************************* Now only one of them imports the other, and this most be the simplest way of illustrating the intra-package references. But how do I get this to work?
-- http://mail.python.org/mailman/listinfo/python-list