473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Pychecker

Howdy, I had the impression that pychecker caught and reported such
dynamic syntactical errors.

#!/usr/bin/env python
def add(i):
i += 10

status = 3

if 1 == 1:
statuss = 15

add(status)

=======================

exalted sysfault$ pychecker foo.py
Processing foo...

Warnings...

None

=======================

Hence the mispelling of status (statuss), which was done purposely to test
if pychecker will acknowledge and report the error. Do i need to enable
some type of pychecker option in order for it to pick up the error? I know
that it is syntactically correct in python, however it's likely that
'status' is meant. Am i wishing that pychecker will replace a statically
typed language mechanism?

--
A wise man knows he knows nothing.

Jun 9 '06 #1
4 1917
Anthony Greene <sy******@zetafunc.net> wrote in
news:pa****************************@zetafunc.net:
Howdy, I had the impression that pychecker caught and reported such
dynamic syntactical errors.

#!/usr/bin/env python
def add(i):
i += 10

status = 3

if 1 == 1:
statuss = 15

add(status)

=======================

exalted sysfault$ pychecker foo.py
Processing foo...

Warnings...

None

=======================

Hence the mispelling of status (statuss), which was done purposely to
test if pychecker will acknowledge and report the error. Do i need to
enable some type of pychecker option in order for it to pick up the
error? I know that it is syntactically correct in python, however it's
likely that 'status' is meant. Am i wishing that pychecker will
replace a statically typed language mechanism?


I think you're asking a lot from pychecker.

kop = 1
koi = 2

if True:
koo = 3

What would you like pychecker to report?
--
rzed

Jun 9 '06 #2
Anthony Greene wrote:
Howdy, I had the impression that pychecker caught and reported such
dynamic syntactical errors.

#!/usr/bin/env python
def add(i):
i += 10

status = 3

if 1 == 1:
statuss = 15

add(status)

=======================

exalted sysfault$ pychecker foo.py
Processing foo...

Warnings...

None

=======================

Hence the mispelling of status (statuss), which was done purposely to test
if pychecker will acknowledge and report the error. Do i need to enable
some type of pychecker option in order for it to pick up the error? I know
that it is syntactically correct in python, however it's likely that
'status' is meant. Am i wishing that pychecker will replace a statically
typed language mechanism?


That's a functional error, not a syntactical one. Analyzing the
spelling of variables for similarity would lead to a lot of incorrect
warnings since pychecker has no way to tell this apart from intentional
similar spellings such as:

values = [1, 2, 3]
value = values[0]

However, when the misspelling is made inside a local scope, rather than
at the module level a warning is reported "test.py:8: Local variable
(statuss) not used":

def add(i):
i += 10

def test():
status = 3
if 1 == 1:
statuss = 15
add(status)
This is why tools like pychecker (or pyflakes, pylint, or even a static
code compiler) aren't a substitute for unit tests. They can definitely
help catch common mistakes, but they can't ensure your code does what
you intended.

--
Matt Good

Jun 9 '06 #3

Rick> I think you're asking a lot from pychecker.

Rick> kop = 1
Rick> koi = 2

Rick> if True:
Rick> koo = 3

Rick> What would you like pychecker to report?

I thing the OP was hoping for a "not used" error, but it can only reasonably
do that within a function, which it does do:

pyc.py:2: Local variable (kop) not used
pyc.py:3: Local variable (koi) not used
pyc.py:6: Local variable (koo) not used

At the module level it doesn't know that the suspect object isn't accessed
from another module.

Skip
Jun 9 '06 #4
On Fri, 09 Jun 2006 11:46:59 -0700, Matt Good wrote:
Anthony Greene wrote:
Howdy, I had the impression that pychecker caught and reported such
dynamic syntactical errors.

#!/usr/bin/env python
def add(i):
i += 10

status = 3

if 1 == 1:
statuss = 15

add(status)

=======================

exalted sysfault$ pychecker foo.py
Processing foo...

Warnings...

None

=======================

Hence the mispelling of status (statuss), which was done purposely to test
if pychecker will acknowledge and report the error. Do i need to enable
some type of pychecker option in order for it to pick up the error? I know
that it is syntactically correct in python, however it's likely that
'status' is meant. Am i wishing that pychecker will replace a statically
typed language mechanism?


That's a functional error, not a syntactical one. Analyzing the
spelling of variables for similarity would lead to a lot of incorrect
warnings since pychecker has no way to tell this apart from intentional
similar spellings such as:

values = [1, 2, 3]
value = values[0]

However, when the misspelling is made inside a local scope, rather than
at the module level a warning is reported "test.py:8: Local variable
(statuss) not used":

def add(i):
i += 10

def test():
status = 3
if 1 == 1:
statuss = 15
add(status)
This is why tools like pychecker (or pyflakes, pylint, or even a static
code compiler) aren't a substitute for unit tests. They can definitely
help catch common mistakes, but they can't ensure your code does what
you intended.


Thanks guys, exactly what was needed.
--
A wise man knows he knows nothing.

Jun 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: achrist | last post by:
The pychecker site says that pychecker works with versions 1.5 through 2.2. Any reason to expect that 2.3 breaks it? Anyone tried it to see? TIA Al
0
by: Pedro Werneck | last post by:
Hi, I don't know if I should ask this here or on an emacs group/list. If I choose wrong, please forgive me. I am trying to run pychecker on the current buffer on python-mode using the...
1
by: Neal Norwitz | last post by:
A new version of PyChecker is (finally) available for your hacking pleasure. It's been quite a while since the last release--11 months. I wish there was more progress, but such is life. Many bug...
10
by: Kylotan | last post by:
Is there a practical way to use Pychecker in Windows? It doesn't work under IDLE. (In fact, it seems to end up breaking everything, and every subsequent statement and expression I execute gets...
12
by: Stephen Ferg | last post by:
I've just spent several very frustrating hours tracking down a bug in one of my programs. The problem was that I was writing text to a file, and when I was done I coded f.close when I should...
4
by: beliavsky | last post by:
If I run PyChecker on the following program, stored in xtry.py, m = 10000000 k = 0 for i in xrange(m): k = k + i print k x = range(3) print x
8
by: Frans Englich | last post by:
Hello, I take PyChecker partly as an recommender of good coding practice, but I cannot make sense of some of the messages. For example: runner.py:878: Function (main) has too many lines (201)...
21
by: Philippe Fremy | last post by:
Hi, I would like to develop a tool that goes one step further than pychecker to ensure python program validity. The idea would be to get close to what people get on ocaml: a static verification...
1
by: Neal Norwitz | last post by:
Special thanks to Ken Pronovici. He did a lot of work for this release and helped ensure it occurred. Version 0.8.15 of PyChecker is available. It's been over a year since the last release. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.