Advice on the style to use in imports

Fredrik Lundh fredrik at pythonware.com
Sat Aug 30 08:20:47 EDT 2008


Marco Bizzarri wrote:

> I'm showing what I used in my current project, and will accept your
> advices on how I should change them.
> 
> The style is consistently the following:
> 
> from package.subpackge.module import MyClass
> 
> Is this an accepted way to write imports? According to what I
> understood in articles, I don't think so.

importing objects instead of the module (namespace) they live in can 
cause all sorts of aliasing and dependency issues.  avoid unless you 
know exactly what you're doing.

</F>




More information about the Python-list mailing list