Python Lint? (was "Can Python supplant Java?")
Neal Norwitz
neal at metaslash.com
Thu Aug 22 18:26:35 EDT 2002
On Thu, 22 Aug 2002 14:02:29 -0400, Webb Sprague wrote:
> Hi All,
>
> It seems to me that it would be pretty easy to address the type checking
> question by some thing like the following:
>
> When you are going to use a variable, assign it a default in the
> appropriate type (stringv = '', intv = 0, etc). Run the Python script
> through a lint type program that would flag any variables assigned to
> without such a "declaration" or any variables assigned a new type.
>
> I have been helped by Perl's "use strict;" / "my" feature many times. My
> idea might approximate it.
'Pretty easy' is relative. :-) But there's PyChecker at
http://pychecker.sf.net
$ cat bad.py:
def func():
# initialize our list^h^h^h^hdict
d = []
# do something here
print d.keys()
$ pychecker bad.py
bad.py:6: Object (d) has no attribute (keys)
Neal
More information about the Python-list
mailing list