mnations at gmail.com
Wed Jan 21 19:01:13 CET 2009
> I think you've probably had issues with circular imports (i.e. mutual
> dependencies), unless you can precisely remember what you were doing and
> what went wrong.
That's possible, but circular imports become more of a hazard if you
have to import in several locations. Unify that to one file, and those
problems are much easier to avoid.
And I don't remember exactly what the problem was, but I think it had
to do with calling Tkinter in two different files. Somehow I was
getting an error in one of the files and removing Tkinter from
importing in one of the files solved it.
> I can make up three or four different logical groupings in my
> applications... so what is 'logical' could not be the same for everyone,
> or from every point of view.
That's not the point. The point is that multiple imports can be a
limiting factor if the module imports don't happen to align with the
model they'd like to use for their file layout.
However playing around with the files, I guess it is possible to
create a file that just does imports and then reference them all just
like you would any other extension of the namespace. I created a file
called imports and was able to access the sys module within it by
importing all from imports and calling sys. That way at least all you
have to do is import the one file each time.
More information about the Python-list