"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Saturday, March 06, 2004

pychecker does strictness checking

Jon writes about dynamic languages and static checking (which rightly should be optional IMHO)...

Are there reasons why Python can't, or shouldn't, support something like "use strict"?

The answer in this case is pychecker. I don't know how pychecker's features line up with perl's strict.

Running Jon's example through pychecker like this... pychecker loose.py results in the following:

    File "loose.py", line 2
      print '[' + aNyme + ']';
  NameError: name 'aNyme' is not defined

pychecker does not catch the contributed example to Jon's article. For example running pychecker other-example.py where the contents are...

sysmsg = 'foo&bar'
sysmgs = sysmsg.replace('&',' ')
print sysmsg

This results in no warnings, although I would expect at least a warning that the variable sysmsgs is unused.

Ted mentions Starkiller, which hopefully will be given ongoing support in the Python community.

No comments:

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.