[Numpy-discussion] PyChecker

Charles R Harris charlesr.harris at gmail.com
Tue Mar 20 22:48:46 EDT 2007


On 3/20/07, Pierre GM <pgmdevlist at gmail.com> wrote:
>
> On Tuesday 20 March 2007 15:29:01 Charles R Harris wrote:
> > but I want
> > to suggest that we run pychecker, and maybe pylint, over the python code
> to
> > look for errors.
>
> I'm using Pydev w/ Eclipse that supports pylint. I usually don't have any
> warning from pylint about numpy. Could you be more specific ?
> ___


For instance, make a file warn.py containing the line:

from numpy import *

Then

$[charris at fedora scratch]$ pychecker warn

among the warning returned are

...
/usr/lib/python2.4/site-packages/numpy/lib/type_check.py:30: Local variable
(typecodes) shadows global defined on line 0 in file <unknown>
...
/usr/lib/python2.4/site-packages/numpy/lib/utils.py:287: (object) shadows
builtin

34 errors suppressed, use -#/--limit to increase the number of errors
displayed


Neither is an error, but it is bad style to shadow builtins and unexpected
errors can result. The second warning refers to this bit of code:

def info(object=None,maxwidth=76,output=sys.stdout,toplevel='numpy'):
    """Get help information for a function, class, or module.

       Example:
          >>> from numpy import *
          >>> info(polyval) # doctest: +SKIP

          polyval(p, x)

            Evaluate the polymnomial p at x.

            Description:
                If p is of length N, this function returns the value:
                p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1]
    """
    global _namedict, _dictlist
    import pydoc

    if hasattr(object,'_ppimport_importer') or \
       hasattr(object, '_ppimport_module'):
        object = object._ppimport_module
    elif hasattr(object, '_ppimport_attr'):
        object = object._ppimport_attr

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070320/d5dcbca4/attachment.html>


More information about the NumPy-Discussion mailing list