Arve Knudsen wrote:
Hi

I've found that pylint 0.23.0 will always issue a warning that a reimport takes 
place when I
import a module within a function, even if the module is only imported in that 
one place. I've
verified that pylint 0.21.0 on the other hand does not issue any warning in 
this case. Is this valid
new behaviour in pylint, that importing within functions should be warned 
against??

I would say yes.
In python it is recommended (for as long as I can remember) to import modules only at the top of the file. It makes it easier to find the imports, and it limits import overhead to just during start up.

There are a few exceptions to this rule, the most important being import of a module that you almost never need which takes a lot of time to start.
I have yet to encounter that case though.

Albert
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to