<tt><font size=2>> From: John Reiser <jreiser@bitwagon.com></font></tt>
<br><tt><font size=2>> To: Development discussions related to Fedora
<devel@lists.fedoraproject.org></font></tt>
<br><tt><font size=2>> Date: 10/22/2012 11:25</font></tt>
<br><tt><font size=2>> Subject: tools to catch AttributeError and TypeError
in python code?</font></tt>
<br><tt><font size=2>> Sent by: devel-bounces@lists.fedoraproject.org</font></tt>
<br><tt><font size=2>> <br>
> What is the state of software tools to help catch and prevent<br>
> AttributeError and TypeError in python code? These two classes<br>
> of errors occur often in the bugzilla reports for anaconda<br>
> (recently: </font></tt><a href="https://bugzilla.redhat.com/show_bug.cgi?id=868707"><tt><font size=2>https://bugzilla.redhat.com/show_bug.cgi?id=868707</font></tt></a><tt><font size=2>
).<br>
> I'd like to see fewer AttributeError and TypeError.<br>
> <br>
> Because new attributes and types may be created at run time, in general<br>
> errors may be even harder to find than in languages with static typing.<br>
> Yet for most python code the set of types and attributes is semi-fixed.<br>
> There are no changes at run time except due to importing modules<br>
> which were created long ago. During development, the set of
types and<br>
> attributes changes only in bursts, and often the bursts are weeks
apart.<br>
> <br>
> The tools for python that I found by searching the web [0][1] seemed
to be<br>
> oriented more towards syntax and style, and not including AttributeError<br>
> and TypeError. Nothing even came close to the depth and thoroughness<br>
> of BEAM [2] or Coverity [3] for C/C++. Help?<br>
> <br>
> -----<br>
> [0] google: python code checker<br>
> [1] </font></tt><a href=http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Python><tt><font size=2>http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis#Python</font></tt></a><tt><font size=2><br>
> pychecker<br>
> pylint<br>
> [2] </font></tt><a href=http://alexandria.tue.nl/extra2/afstversl/E/523798.pdf><tt><font size=2>http://alexandria.tue.nl/extra2/afstversl/E/523798.pdf</font></tt></a><tt><font size=2><br>
> (IBM "BEAM" checker [Bugs, Errors, And Mistakes];
Guido Volleberg, 1999)<br>
> *very* good: finds and prints an execution path which
leads to null-pointer<br>
> errors in C and C++; includes call+return, loop+exit,
conditionals, etc.<br>
> Notably helpful in the development of valgrind itself.<br>
> [3] </font></tt><a href="http://www.coverity.com/products/quality-advisor.html"><tt><font size=2>http://www.coverity.com/products/quality-advisor.html</font></tt></a><tt><font size=2><br>
</font></tt>
<br>
<br><tt><font size=2>I'm having pretty good success with PyCharm from JetBrains.
Nothing will ever be as good as those for statically typed languages,
but it's darned good at catching all sorts of things prior to run-time.
My python code has improved in reliability significantly thanks to
PyCharm. I've never been much of an IDE person in the past, but this
tool has convinced me that they do have their uses. I focus far more
on the goal now.</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
--<br>
John Florian</font>
<br>
<br>