Cycles between package imports

Martin Blais blais at furius.ca
Fri Jun 30 22:28:29 EDT 2006


On 6/22/06, Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote:
> 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.

See below.


> >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.

This is irrelevant.   I'm not interested in discussing nor debating
the merits of prohibiting or allowing cyclic imports with you nor with
anybody else, you're wasting your time.

The fact of the matter is that Python DOES allow cyclic imports, and
the way that they behave depends on the particular syntax used to
perform the import.  This very specific particular item is what the
original question was about.   If you want to discuss whether Python
should disallow cyclic imports to prevent users to using them, please
start your own thread.

cheers,


> In general, the complications they introduce are simply not worth it.

"worth it".  Subjective.  Whatever.



More information about the Python-list mailing list