Re: FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-21 Thread david . tolpin
Needs??? Sorry to be blunt, but this is an intrinsically ludicrous concept, in *any* language. The whole idea of modules is (wait for it) modularity. A imports B which imports A is an utter nonsense. There is such a thing called 'recursion'. Self-recursion is when function x calls itself to

Re: FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-20 Thread John Roth
Circular import dependencies don't work well; depending on the exact conditions they can leave you pulling your hair out for hours. In your example, just pull the global variable out into a third module and have both of your major modules import and reference it from there. In general, you should

FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-19 Thread MackS
Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main(): import auxiliary_mod instance = auxiliary_mod.ClassA() instance.fun() return main() # file auxiliary_mod.py: class ClassA:

Re: FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-19 Thread Reinhold Birkenfeld
MackS wrote: Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main(): import auxiliary_mod instance = auxiliary_mod.ClassA() instance.fun() return main() # file

Re: FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-19 Thread John Machin
On 19 Mar 2005 12:05:18 -0800, MackS [EMAIL PROTECTED] wrote: Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main(): import auxiliary_mod instance = auxiliary_mod.ClassA() instance.fun()