On 17 février 09:51, Arve Knudsen wrote:
> While this is a sound guideline, it should not be applied with religious
> zeal. In contrast to a purely stylistic matter such as the naming of
> classes/variables etc., local imports can be motivated by technical
> concerns. When you perform local imports, it does not only affect the
> program's readability, but also its *behaviour*. I will in the general case
> import globally at the beginning of my modules, but in certain cases I want
> to defer module loading, maybe depending on a user option, and delegate it
> to a function. Therefore, I think pylint (for instance) should leave this to
> the programmer's discretion, and not try to be too smart about it. It's
> complicated enough in my experience to define style rules that don't get too
> much in your way, in real life applications.

That is expected pylint behaviour, for now. And I personnaly don't wish to
change it. Though we could add a special warning message for 'local' imports
(fairly easy to implement). If someone wish this behaviour, he can file a
ticket :)

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

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

Reply via email to