16.02.2011 23:26, Arve Knudsen <[email protected]>: > A linter, to be truly useful, has to straddle the line between too > forgiving and too strict; if pylint by default were to decide that I > am breaking good style by importing within functions, I'd see it as > going way overboard as to its practical purpose (and perhaps > question its place in my tool chain). It might make sense, on the > other hand, as a non-default check (maybe custom) for those projects > that view the practice as a problem.
That would be all projects following the style guide for the standard
library in PEP 8 which clearly says in the `Imports` section:
- Imports are always put at the top of the file, just after any module
comments and docstrings, and before module globals and constants.
I think such a check has its place as default check. Putting the
imports at top makes clear which dependencies a module has. Opposed to
``import``\s buried deep in the module that are not just harder to find
but the reader also has to think about if and when a function is called
and the dependencies really is a dependency.
Ciao,
Marc 'BlackJack' Rintsch
--
“On the eighth day, God telephoned his lawyers and began
asking all sorts of questions about product liability.”
-- Tom Holt, Overtime
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
