Forgot your password?
typodupeerror
Python Programming

Open-Source Python Code Shows Lowest Defect Density 187

Posted by Soulskill
from the errors-should-never-pass-silently dept.
cold fjord sends news that a study by Coverity has found open-source Python code to contain a lower defect density than any other language. "The 2012 Scan Report found an average defect density of .69 for open source software projects that leverage the Coverity Scan service, as compared to the accepted industry standard defect density for good quality software of 1.0. Python's defect density of .005 significantly surpasses this standard, and introduces a new level of quality for open source software. To date, the Coverity Scan service has analyzed nearly 400,000 lines of Python code and identified 996 new defects — 860 of which have been fixed by the Python community."
This discussion has been archived. No new comments can be posted.

Open-Source Python Code Shows Lowest Defect Density

Comments Filter:
  • by Anonymous Coward on Tuesday September 03, 2013 @05:25PM (#44751007)

    "Coverity fails to detect errors in python" would be my headline of choice here. Seem a much more reasonable explanation for the results.

  • by caffeinemessiah (918089) on Tuesday September 03, 2013 @05:38PM (#44751131) Journal
    So a private, for-profit company named "Coverity" has released a report that shows that their "Coverity Scan" software finds the fewest vaguely-defined "defects" in a programming language whose community has added the "Coverity platform" product to their development process? I was about to say "excellent marketing" by writing a fluff piece for free Slashdot traffic, but it's really not even excellent marketing.
  • by vux984 (928602) on Tuesday September 03, 2013 @06:23PM (#44751461)

    Python is readable and readable code is easier to fix.

    True and true. But Python's use of semantic whitespace is also very brittle very easy to break, and a huge pain in the ass to fix compared to languages that use braces, or keywords to define 'blocks'.

    But that's not even terribly relevant here, because this article is about the source code used for the python interpreter, which is C, not python.

  • by XcepticZP (1331217) on Tuesday September 03, 2013 @06:37PM (#44751555)

    But Python's use of semantic whitespace is also very brittle very easy to break, and a huge pain in the ass to fix compared to languages that use braces, or keywords to define 'blocks'.

    This is one thing I never quite get about python criticism. Sure, whitespace is significant, but I've never had it break easily or be "brittle" as you say. Then again, I don't go past 2 or 3 levels of nesting, class nesting included. And all my units of work are in separate methods/functions instead of being child blocks inside a giant function which I've regularly seen done. Perhaps the use of whitespace isn't the real issue many people have with python, but rather delineating blocks using whitespace exposes a bit of an inherent flaw in the way they structure their program's flow.

    Either way, having a proper IDE when writing python code will go a long way to making you comfortable with using whitespace instead of braces. Initially it was weird and unsettling for me, because I didn't understand all the consequences that whitespace could have. But a little fluid and constant coding in a IDE will rid you of that quick enough.

  • Re:WRONG! RTFA! (Score:5, Insightful)

    by Zero__Kelvin (151819) on Tuesday September 03, 2013 @06:46PM (#44751603) Homepage

    "I quote: "Coverity scanned over ten thousand Python programs on the popular GitHub open-source software repository...""

    Great. Now where the hell do you quote it from, since that sure as hell isn't in the linked to article anywhere.

    "Coverity's scanning technology has analyzed more than 396,000 lines of code in the latest builds of Python 3.3.2. That analysis has led to 181 new defects being identified. For the year to date, Python developers have already fixed 278 defects. - See more at: http://www.eweek.com/developer/open-source-python-code-sets-new-standard-for-quality-study.html#sthash.wSdGotDE.dpuf [eweek.com]"

    That makes it pretty clear that they are talking about the Python executable itself. Version 3.3.2 to be exact.

    "One of the more interesting defects that Coverity identified in Python that developers have since fixed is a "double-free" defect. "'Double free' means that you allocate memory for a pointer, and then you free the memory twice," Samocha explained. "This can cause memory corruption, which can lead to unexpected behaviors or program crashes." - See more at: http://www.eweek.com/developer/open-source-python-code-sets-new-standard-for-quality-study.html#sthash.wSdGotDE.dpuf [eweek.com]"

    ... and that clearly shows that they are talking about the interpreter, written in C, which has pointers, malloc() and free(). Python has a memory manager with garbage collection and doesn't use pointers. The Python programmer doesn't allocate and free memory resources directly.

    I especially love how you criticized a language earlier, when you clearly have literally no knowledge of said language.

  • by fahrbot-bot (874524) on Tuesday September 03, 2013 @07:51PM (#44752015)

    Sure, whitespace is significant, but I've never had it break easily or be "brittle" as you say.

    Not python, but one example of this type of thing would be in a Makefile where target commands are indented by a tab. Some newer versions of (g)make will allow spaces, but most require a tab. Cut and paste that in an X-Windows session (tabs are converted to spaces) and you're screwed. From Make Software: Makefiles [wikipedia.org]

    Each command line must begin with a tab character to be recognized as a command. The tab is a whitespace character, but the space character does not have the same special meaning. This is problematic, since there may be no visual difference between a tab and a series of space characters. This aspect of the syntax of makefiles is often subject to criticism.

  • by vux984 (928602) on Tuesday September 03, 2013 @09:05PM (#44752443)

    This is one thing I never quite get about python criticism. Sure, whitespace is significant, but I've never had it break easily or be "brittle" as you say.

    Anytime you refactor stuff, or modify something even somewhat nested, especially in a 'dumb text editor', it's a pain in the ass.

    Anytime you need to pass code snippets via email, forums, etc... well... you just don't because its a total waste of time. :)

    Its also easy to barf all over code going into word processors, pdf files, and so forth. Its nice to be able to copy-paste some C out of a PDF file or an email, or off a forum, and then tell the ide to just reformat it.

    erhaps the use of whitespace isn't the real issue many people have with python, but rather delineating blocks using whitespace exposes a bit of an inherent flaw in the way they structure their program's flow.

    No. Because we use whitespace / indenting in our C / C++ etc projects too. We even have standards requiring it, and our IDEs / toolchains may even be set up to reformat it just-so before commits. We want all the benefits of well formatted code.

    We just like the IDE to do all the work actually formatting it, and reformatting it as neccessary.

    Either way, having a proper IDE

    Is how you lose the argument. Everyone but python groupies agrees that any programming language worth considering MUST have its programs represented as plaintext files, with no proprietary / binary stuff that can only be accessed with specialized tools. Requiring an IDE is the sign of a bad language.

    Python passes this test, but it can be pretty hideous to use with an arbitrary text editor. And really, even brainfuck wouldn't be too bad with the right IDE, right?

  • by vux984 (928602) on Wednesday September 04, 2013 @03:59AM (#44754163)

    Blaming Python because you don't have a rudimentary coding editor is like blaming math because you don't have a calculator with a cosine button.

    I don't have the luxury of designing "math". Irrational numbers, periodic functions, and so forth aren't optional.

    But we do have the luxury of designing programming languages, and semantic white space is a choice.

"A mind is a terrible thing to have leaking out your ears." -- The League of Sadistic Telepaths

Working...