next up previous
Next: Python 2 and Python Up: A first Python script: Previous: A first Python script:

What is a Scripting Language?

When you type commands in the terminal window, your commands are interpreted by the "shell" and cause the operating system to do things, such as produce a directory listing or execute a program. If you put a bunch of those commands in a file, you have created a "shell script." Likewise, when you collect gnuplot commands in a file, you have created a gnuplot script, which is interpreted by gnuplot. The same is true for Python. A program, in constrast to scripts, is a collection of instructions that are processed by a compiler before you get something that can be executed. In a way, Python is a bit of a hybrid. Python interprets its scripts line-by-line as with gnuplot or the shell, but, behind the scenes, it may do some compilation as well. In this course we will often refer to a Python script as Python code.

Generally speaking, compiled C++, C, Fortran, etc. code is more efficient than a script, because compilers are designed to work hard at analyzing and optimizing the code as a whole and at targeting it to a specific computer architecture. Scripting languages are designed primarily for ease of use, rather than speed. Python has evolved and been extended with specialized packages to the point that in some cases it is quite efficient. However, for the best performance, compiled code is usually the best choice.


next up previous
Next: Python 2 and Python Up: A first Python script: Previous: A first Python script:
Carleton DeTar 2017-08-10