On Fri, Dec 20, 2013 at 4:12 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > But why is so much non-performance critical code written in C? Why so > many user-space applications?
Very good question! I don't have an answer. There are a few "maybe-answers", but they mostly come down to "programmer didn't know of a viable alternative". When I wrote RosMud, I wrote it in C++, because I was making tweaks to an existing C++ program (Gmud) and because I thought that that was the way to make it run fast enough for what I needed. Seven years on (or will be, come January), I've learned how much can be done in Python, Pike, and other high level languages, and RosMud's successor is not written in C. Maybe part of the answer comes from people who've learned based on old hardware. Growing up in the 80s on an Epson XT-clone, I wrote code in BASIC, C, and assembly. Now, most of my performance problems in BASIC were because of flawed algorithms (it's amazing how slowly an O(n*n) algorithm will run, isn't it!), but I could imagine someone growing up learning "C is the only way to make code run fast" and then going on to teach the next generation of programmers to use C, without necessarily even explaining why. But that's just speculation. All I know is, even if you do need to write in C for some reason (your preferred language doesn't have bindings for some library, maybe), chances are you can write the tiniest bit of code that way, and do the rest in a high level language. ChrisA -- https://mail.python.org/mailman/listinfo/python-list