In <[EMAIL PROTECTED]>, Michael Yanowitz wrote: > 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?
AFAIK that's a requirement at Logilab. They use the tool themselves. :-) > 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. I guess more often than you think. > 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. If they are constants then you don't rebind them from within functions or methods, right? Then you don't need ``global``. This works without problems:: ANSWER = 42 def spam(): print ANSWER > 4) W:261:getDiscreteData: Catch "Exception" > What is wrong with that? It catches *any* exception. For example `KeyboardInterrupt` which can lead to programs that can't be stopped with CTRL+C or `ZeroDivisionError` or `NameError` so programming errors are silenced. > 5) R:547:readDiscreteData: Too many branches (28/12) > Python doesn't have the switch/case statements that C/C++ have. So I > could have a large block if/elif/else statements. > Is there any way to avoid that? One idiom is to create a dictionary with the values to "switch on" mapped to callables to handle the case. > 6) R:722:waitDiscretes: Too many local variables (38/15) > That's new to me. What is wrong with too many local variables? Well, they are just to many. :-) > 7) W:933:sendStringToSocket: Redefining name 'nPortNumber' from outer scope > (line > What is wrong with using the same variable name in a function that is > used by its caller? It's not used by the caller but in the outer scope. It may confuse the reader seeing `ham` in the outer scope and then `ham` in the function without noticing that this is actually another `ham`. > 8) W:995:sendStringToSocket: Used builtin function 'map' > Is that a problem? `map` is "deprecated" in favor of list comprehensions. A matter of tasteā¦ Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list