Advice on the style to use in imports
Marco Bizzarri
marco.bizzarri at gmail.com
Sat Aug 30 08:12:11 EDT 2008
Hi all.
I read the PEP8 and the "importing Python Modules" article. However,
I'm still a little confused on what should the general rules for
importing modules.
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.
If I understand it correctly, it should be:
import module
and then use
module.MyClass
( in case of a flat module)
or
from package.subpackage import module
and then use
module.MyClass
(( for a package/subpackage structure ))
Thank you all for your attention
Regards
Marco
--
Marco Bizzarri
http://iliveinpisa.blogspot.com/
http://notenotturne.blogspot.com/
More information about the Python-list
mailing list