include in python

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon May 5 07:10:13 EDT 2003


Bartek Golenko wrote:
> Irmen de Jong <irmen at -NOSPAM-REMOVETHIS-xs4all.nl> wrote:
>>from your_module import *

> 
> # prog.py
> 
> from xxx import *
> 
> def hello():
> 	print "Hello..."
> 
> # xxx.py
> 
> hello()
> 
> It will not work unless I do
> 
> # xxx.py
> import __main__
> 
> __main__.hello()
> 
> Which is sth I really want to avoid ;)
> 

You have a back-dependency here: xxx.py uses something in prog.py.
If you are splitting things this way, you're doing something wrong
IMHO. The parts that you split off should really be self-contained
(that's what I assumed).

Why do you want to split up your source in this way??
If it is a prototype, why not just let it be one big chunk,
and think about proper modularization later when you write
the real thing?

--Irmen





More information about the Python-list mailing list