In article <631e2879-6171-417e-8254-7f78c8cfc...@i24g2000prf.googlegroups.com>,
alex23  <wuwe...@gmail.com> wrote:
>
>If you're having to set up your imports in a specific order, odds are
>you have either a circular dependency or are overusing 'from <module>
>import *'. You should -never- (IMO) do something like 'from <some
>library> import x, y, z' in module 'a' and then 'from a import *' in
>module 'b'. If 'b' uses x, y & z, it should import them itself. If you
>-must- use 'import *', specify exactly what should be exported via
>'__all__'...in most cases, it should be restricted to only objects
>defined within that module.

There's one other way to run into this problem: I forget the exact
mechanics, but if you mix up absolute and relative imports for modules
inside packages, you can get namespace problems.  (It's also possible
newer versions of Python don't have this issue.)
-- 
Aahz (a...@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to