On 6 March 2014 11:50, Brian May <[email protected]> wrote:
> On 6 March 2014 11:34, William ML Leslie <[email protected]>wrote: > >> specifically, 'import module' loads and initialises the module if needed, >> and then binds the name 'module' to the module. >> >> 'import package.module' loads and initialises package, and then module, >> if needed. then, it binds the name 'package' to the top-level package. >> >> 'from module import name' loads and initialises the module if needed, and >> then binds the name 'name' to the value of 'module.name'. >> >> So the names within the current module are different for the two examples >> you give - the first binds '__version__' also, and the second binds >> 'module' also. >> > > Seems to be that there is more to it then that. > > For example. if in module/__init__.py I have: > > import module.something > > I get an circular import loop. The import "module.something" seems to > imply an import of "module". > While the package (here module) has not finished initialisation, it is still importable. The result is that anything under 'import module.something' won't be run until module.something itself is initialised. > > However, if instead, I do: > > from module.something import somethingelse > > Then the circular import loop disappears. > Whatever bug you're seeing is from some other source, sorry. -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely may reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to deny you those rights would be illegal without prior contractual agreement.
_______________________________________________ melbourne-pug mailing list [email protected] https://mail.python.org/mailman/listinfo/melbourne-pug
