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. 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
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
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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
|
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...
|
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...
|
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...
|
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...
|
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
|
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)...
|
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...
|
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. ...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |