__slots__

Antoon Pardon apardon at forel.vub.ac.be
Mon Mar 27 12:06:57 CEST 2006


Op 2006-03-25, John J. Lee schreef <jjl at pobox.com>:
> aleaxit at yahoo.com (Alex Martelli) writes:
> [...]
>> you should be using pychecker or pylint
> [...]
>
> I'm curious, as somebody who doesn't regularly use these tools: How do
> they fit into your workflow?  Do you run them every few hours, every
> day, every time you run functional tests, every release, every so
> often, on gut feeling about when it's likely to catch problems...?
>
> How do you cope with spurious warnings?  Does it involve tweaking code
> to quell warnings?  Keeping suppression lists?  Maintaining special
> invocations of pychecker / pylint per-project?  Do they cope well with
> other people's code who do not use these tools?

IMO they don't cope well unless you adapt to what they expect.

I just tested the two.

pylint gave me countless warnings because I use two space to indent
instead of four. It also didn't like that I used uppercase letters
in my identifiers. That there was no space after a comma or
around an operator was a problem too.

That I use the same name for the index variable of for loops in
different scopes is also warned about.


Pychecker also warns about these shadowed variable. Pychecker
goes even so far to warn you that a local variable in an imported
module is shadowing a global variable of yours. Like the following
line:

/usr/lib/python2.3/random.py:247: Local variable (i) shadows global
defined on line 43 in file demo1a.py

So it seems pychecker thinks I shouldn't use something like

for i in lst:
  ...

in my code at the global level because some module in the standard
library has a function with a local i.

Pychecker also froze on my system.


I don't recommend the use of these tools.

-- 
Antoon Pardon



More information about the Python-list mailing list