Cycles between package imports
ldo at geek-central.gen.new_zealand
Thu Jun 22 10:52:50 CEST 2006
In article <mailman.7281.1150868507.27775.python-list at python.org>,
"Martin Blais" <blais at furius.ca> wrote:
>On 18 Jun 2006 05:25:14 -0700, John Roth <JohnRoth1 at jhrothjr.com> wrote:
>> The general rule is: don't do that. It doesn't work, and the
>> hoops you have to go through to force it to work are so
>> complex and bizzare that they're not worth it. Redesign
>> the modules so you don't have cyclic dependencies.
>This is a matter completely aside the question.
No it isn't. I agree with John Roth.
>Whether it's worth it
>or not depends on the specific case --not included in the example--
>and in the case where it shows up in my code, removing the cycle
>actually made sense (it does, most of the time, but not always).
See, even you are unable to come up with an example where a cyclic
import makes sense.
In general, the complications they introduce are simply not worth it.
This was discovered decades ago, during the development of languages
like Ada and Modula-2 which could do automatic initialization and
finalization of library modules arranged by the compiler/linker system.
More information about the Python-list