[Python-Dev] relative import circular problem

Kristján Valur Jónsson kristjan at ccpgames.com
Thu Apr 4 11:36:11 CEST 2013

> -----Original Message-----
> From: Eric Snow [mailto:ericsnowcurrently at gmail.com]
> Sent: 4. apríl 2013 04:57
> > imported by both of the original modules. At that point, the code is
> > cleaner and more decoupled, and the uneven circular import support
> ceases to be a problem for that application.
> +1

I tried to make the point in an earlier mail that I don't think that we ought to let our personal opinions de-jour on software architecture put a constraint on our language features.
There can be good and valid reasons to put things that depend on each other in separate modules, for example when trying to separate modules by functionality or simply when splitting a long file into two.
Notice that cyclic dependencies are allowed _within_ a module file.  Imagine if we decided that we could only refer to objects _previously_  declared within a .py file, because it encouraged the good design practice of factoring out common dependencies.
Dependency graphs of software entities can sadly not always be reduced into a DAG, and we should, IMHO, by no means force people to keep each cygle in the dependency graph within a single .py module.


More information about the Python-Dev mailing list