[Python-projects] pylint and scipy/numpy
Alexandre Fayolle
alexandre.fayolle at logilab.fr
Fri Feb 22 14:42:43 CET 2008
----- Forwarded message from Duncan Gibson <duncan.gibson at xs4all.nl> -----
> My python files import scipy. And if i use any function of scipy (fft,
> arange, zeros, ...), pylint complains with :
> E0602:440:Interceptor.apply_channel: Undefined variable 'zeros'
> Of course, the program works. But my pylint score is bad. [...]
I've just been through a similar exercise with Numeric because its
"submodules" import everything via *, and MLab redefines max, min,
sin, etc. In the end, we've made all imports explicit:
from math import (acos, asin, ...)
from Numeric import (array, ..., zeros)
from MLab import eye
from Precision import Float
from Scientific.Geometry.VectorModule import Vector
In fact, I pasted a standard list into each module, and then used
pylint to identify which names were not used and trimmed the list.
Now we are sure that we use the math functions from the standard math
module; we avoid problems with [incompatible] redefinitions, and we
know where we need to change if and when we move to numPy and sciPy.
Plus, your pylint score improves :-)
Cheers
Duncan
----- End forwarded message -----
--
Alexandre Fayolle LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Informatique scientifique: http://www.logilab.fr/science
More information about the Python-Projects
mailing list