On Fri, 25 Dec 2015 19:24:01 +0100
Edward Bartolo <edb...@gmail.com> wrote:

> Hi,
> 
> One persistently tempting question about using Python, or any other
> interpreted programming language, is why they are used? 

I can answer that, always assuming speed and hardware interfacing
aren't an issue:

1) For performing the same task, Python's always much easier to
   program. And easier algorithms mean less dark corners for bugs to
   hide.

2) Python (and Perl, Ruby, Lua and Scheme) is already debugged and
   secure. Without C's pointers, overflowable arrays, manual garbage
   collection, matching of mallocs and frees, and other security
   problems, one can write a secure Python program with a lot less
   security knowledge.

3) Assuming your Python program doesn't import a bunch of seldom-used
   Python libraries, deployment is *much* easier. Deploying a
   well-written Python program is a mere wget. I once had a distro with
   a bad or missing youtube-dl package. Because it's just a python
   script, I copied it from the Internet onto my path, and bang, I had
   youtube-dl. Try that with any C program.

4) Python has several ways of invoking a binary program, so if one part
   of the project absolutely requires C, that part can be a tiny C
   program that's easy and secure to program, and have it called by
   Python.

5) A lot of the functionality of a C program could be imitated by
   existing POSIX tools like cat, grep, awk, sed, cut, sort, gzip, and
   the like. Running these programs first, in order to cut way down on
   the data transfer, can allow the stdout to go into a Python program
   that can keep up with the process.


Truth be told, if I were a business' manager of software development,
any time somebody wanted to write something in C I'd make him/her
justify doing so by proving it would be disadvantageous to write it in
Python (or Perl or Ruby or Lua or Scheme or whatever).


SteveT

Steve Litt 
November 2015 featured book: Troubleshooting Techniques
     of the Successful Technologist
http://www.troubleshooters.com/techniques
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to