Michael Yanowitz escribió:
> Hello:
>
> I ran the new pylint and my code and I had a few questions on why those
> are warnings or what I can do to fix them:
>
> 2) C: 0: Missing required attribute "__revision__"
> What is this? Is that for CVS? I don't use CVS (we use SVN). I have not
> seen any sample code which includes this tag yet. But if I include
> __revision 1.0 somewhere in the code it will remove that warning?
try it and see what happens
> 3) W:230:readDiscreteData: Using the global statement
> What is wrong with using the global statement? I know the use of Globals
> should be discouraged, but often they can't be avoided.
> Suppose I have a constant. In C or C++, I could just use a #define and
> it would be known throughout the whole file. In Python, there isn't a
> similar construct, so rather than creating a large parameter list, of
> constants, I like to use globals.
* define all your constants in a separate module constants.py, then:
from constants import *
* add the constants to __builtins__
__builtins__.constant_name = value
this approach is a bit tricky
> 4) W:261:getDiscreteData: Catch "Exception"
> What is wrong with that?
cause you're masquerading *all* exceptions, this could be potentially
dangerous
> 6) R:722:waitDiscretes: Too many local variables (38/15)
> That's new to me. What is wrong with too many local variables?
> Can anything be done to improve that besides having too many globals?
too many local variables probably means "too complex function, split it
in smaller functions"
--
http://mail.python.org/mailman/listinfo/python-list