Re: "no variable or argument declarations are necessary."
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "no variable or argument declarations are necessary."

From: marduk <usenet@marduk.letterboxes.org>
Date: Tue Oct 04 2005 - 03:01:03 CEST

> egold = 0:
> while egold < 10:
> if test():
> ego1d = egold + 1
>

Both pylint and pychecker pick this up. I wrapped the code in a
function (to prevent importing from running in an infinite loop) and ran
both pylint and pychecker:

plyint: W: 5:myfunc: Unused variable 'ego1d'
pychecker: test.py:4: Local variable (ego1d) not used

I make a habit to run pylint or pychecker on my code often. They pick
up a lot of stuff like unused variables, etc.

But you can also do this:

/* initialize variables i'm gonna use */
int vara = 0;
int varb = 0;
while (vara < 10) {
    varb = vara + 1;
}

So we can make a similar mistake in C if you type the wrong (declared)
variable name. Moreover, "gcc -Wall" did not report the "unused"
variable so it might be even more difficult to track down the problem.
Received on Sat Oct 15 04:05:58 2005