[Python-Dev] Import lock considered mysterious

Paul Moore p.f.moore at gmail.com
Fri Jul 22 12:30:40 CEST 2011


On 22 July 2011 10:29, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> The reason for *that* was that my main module was a stub
> that imported the real main module, which did all its
> work directly from the module code. So the whole program
> was effectively running inside an import statement and
> holding onto the import lock.

I realise you probably know this, but I think this is covered by the
standard advice to avoid having substantial code running at module
level (i.e., on import). It may be useful to clarify or further
emphasize that advice in the Python documentation.

Paul.

PS This is not to say that I oppose trying to reduce the chance of
this type of thing happening...


More information about the Python-Dev mailing list