[Tutor] Which is better Practice and why

eryksun eryksun at gmail.com
Mon Oct 22 20:57:27 CEST 2012


On Mon, Oct 22, 2012 at 2:26 PM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
>
> They both import each other. That is a circular import and it can
> create problems. My advice for this issue is not "avoid importable
> scripts" but rather "avoid circular imports" (a good idea anyway).

I agree it's better to refactor common code to a separate module, but
if you search the net you'll find lots of well-intentioned advice on
how to make circular import scenarios work.

You had said "define a number of scripts that are in the same
directory but share some code by [importing one another]", and I
wanted to be clear about how that related to your comment about the
main module indirectly importing itself. Thanks for taking the time to
clear that up.


More information about the Tutor mailing list