Advice on the style to use in imports
bdesth.quelquechose at free.quelquepart.fr
Sat Aug 30 19:16:18 CEST 2008
Marco Bizzarri a écrit :
> 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?
Yes, BUT : it means that if package.subpackge.module.MyClass is rebound
during program execution (ie: after you imported it), your own code
won't see that change.
More information about the Python-list