circular import Module

Douglas Soares de Andrade dsa at unilestemg.br
Wed Jun 8 08:41:50 EDT 2005


Hi !

> Circular import does not work on module level, but you can
> import the module in a method:
>
> file1.py:
> import file2
> ....
>
>
> file2.py:
> # import file1 # Does not work!
> def foo():
>     import file1 # Does work

Cool idea !

It works on local namespaces, wich dont cause trouble to the whole program.

+1


-- 
Douglas Soares de Andrade
http://douglasandrade.cjb.net - dsa at unilestemg.br
UnilesteMG - www.unilestemg.br
ICQ, MSN = 76277921, douglas at tuxfamily.org




More information about the Python-list mailing list