I know python is not suitable for things like microcontrolers, make drivers etc, but besides that, you can do everything using python, companys get stuck with speed optimizations for real hard time system but does forget other factors which one you can just upgrade your hardware for speed proposes in order to get your python program fit in it, if you think how much cust can the company have to maintain a system written in C, the comparison is like that: for example: 10 programmers to mantain a system written in c and just one programmer to mantain a system written in python, with python you can buy some better hardware to fit your python program, I think that low level languages tend to get more cost, since programmers aren't so cheaply than a hardware upgrade, then, this is my point, why should a system be written in c instead of python?
closed as not constructive by ChrisF♦ Nov 24 '11 at 16:27
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
The main reason is because the software was already written in C (or C++ or whatever) before Python became a legitimate choice.
If it's a question of rewriting your million lines of C code into Python or continuing with the C code, then the choice is clear. If you spend 12 month rewriting the code in Python, then that's 12 months where you're not adding new features and you'll basically spend 12 months getting back to exactly where you were.
Not to mention that fact that you'll probably have missed all those corner-case bugs that had been fixed over the years in the C version, but not really called out in the code so when your Python dev comes along to port it and says "why does the code do this? That seems wierd... I'll just do it this other way" he's actually forgetting about that customer from 6 years ago who lost 12 months worth of payroll because of this obscure bug in their RAID controller that was worked around with just that specific piece of code.
It's basically the same answer people get when they ask "Why doesn't Microsoft rewrite Windows or Office or (insert-product-here) in .NET? I thought .NET was the poster-child for all Microsoft development these days?"
Now, when it comes to developing new products, then Python (and all the other possible choices) become a more viable option. But you've still to weigh the benefit of going with Python (or whatever) over C or C++, particularly when your new product may be interfacing with lots of existing code that you've already got written in C or C++.
Because even when you're not writing "low-level applications" such as device drivers, the need for low-level code tends to show up in all sorts of places, especially for performance optimizations in computation-intensive parts of your app. This is common enough even in apps written in C and other static, fully-compiled languages, and it only gets worse when you start throwing inherently slow "high-level" language features such as dynamic typing and managed pointers into the equation.
When you have a language that abstracts away all the low-level details, such as Python, you are not able to get down to the level required to fix problems like this. That's why you tend to see the pattern of writing the core code in a compiled language, and then implementing lightweight business logic in a scripting language that runs on top of the core code, increasing in popularity quite a bit lately.
Well I understood your question as "Why continue to write things in C/C++ when better alternatives are present." Not let's rewrite everything just because we have a better hammer. And I agree with you in theory. Why write new things in C or ASM anymore because it turns out there are vastly more problems that work better for "high-level" languages than not.
I think about a story that James Gosling recalled about the Java team. They were looking at huge sections of code in the VM that was originally written in C because they thought it was faster. As time went on and they had to improve it, maintain it, and add new features. The team began to wonder why not move it to Java. They did and it turned out to be just as performant, simpler, and easier to modify. I do think new development should not be done in C/C++, except for those exceptions noted, but what makes our industry continue to grow is the platform change. We haven't really answered any new questions about computer science since the 70s, but we continue to grow in amazing directions. That's largely because every 10 years or so we create new platforms where we have to re-implement everything over there opening up opportunities to transition from previous languages to new ones. That's the secret to our industries success.
Because if the "system" is a scientific library or a go playing program it might require top performances, that's why. If you buy hardware that's 10 times faster, the low level implementation will still perform better.
And then there's a quite philosophic reason, in my opinion: we have to keep in touch with the lowest level of our machines. Losing the knowledge of basic instruments like the C language would be like covering every inch of the earth with cement and build a perfectly working "system" upon it, forgetting about what was down there once that gave us birth and condemning the human race to eternal ignorance.
Kernighan and Ritchie would be very upset about it.
The huge trend in computing is mobile, which from several aspects is not far from microcontroller and embedded system development. Python is not yet the dedicated language for iOS, Android or Windows Phone 7.
In desktop computing, getting faster hardware is more and more difficult: CPU speed is stuck aroud 3GHz and getting all the power of multiple cores is far from easy. Low level languages have an advantage over Python here.
About maintainability, the 10:1 ratio may be true with just-graduated people who have never been exposed to C but know Python and Ruby and all other new languages. For the majority of senior developers, the ratio doesn't favour Python.
Some years ago, everything could be made in Java and be portable at the same time. Some years before, it was Perl. Clearly the actual winners these days are C, C++, C# and Objective-C.
There are some systems that link in C directly. Sure you can proxy your function calls and embed an interpreter, but I can do that with nearly any language.