lint warnings
Ben Finney
ben+python at benfinney.id.au
Mon Feb 14 22:10:38 EST 2011
Andrea Crotti <andrea.crotti.0 at gmail.com> writes:
> I work on emacs with flymake activated and pylint, pyflakes and pep8
> running in background to notify for some style problems.
>
> Now there are at a couple of pylint warnings which I don't understand
> 1. Warning (W, filter_enums): Used builtin function 'map' [2 times]
> what is the problem with using map and other builtin functions?
The ‘map’ builtin is deprecated; using a list comprehension is neater
and more efficient.
> 2. Warning (W): Relative import 'parameters', should be 'othermodule.parameters'
> if I am in the same directory why should I do a relative import, does
> it make any difference?
It makes the code unnecessarily ambiguous; the person reading the code
can't tell that it's a relative import.
> I think it's more clear/safe to just import the 'parameters', am I
> wrong?
You can use the explicit relative import syntax (I don't know if that
satisfies ‘pylint’).
--
\ “I wish there was a knob on the TV to turn up the intelligence. |
`\ There's a knob called ‘brightness’ but it doesn't work.” |
_o__) —Eugene P. Gallagher |
Ben Finney
More information about the Python-list
mailing list