1.2 Is Python a Scripting Language?
Python is a general
purpose
programming language that is often applied in scripting roles. It is
commonly defined as an object-oriented scripting
language—a definition that blends support for OOP
with an overall orientation toward scripting roles. In fact, people
often use the word "script" instead
of "program" to describe a Python
code file. In this book, the terms
"script" and
"program" are used interchangeably,
with a slight preference for
"script" to describe a simpler
top-level file and "program" to
refer to a more sophisticated multifile application.
Because the term "scripting" has so
many different meanings to different observers, some would prefer
that it not be applied to Python at all. In fact, people tend to
think of three very different definitions when they hear Python
labeled a "scripting" language,
some of which are more useful than others:
- Shell tools
-
Tools for coding
operating system-oriented scripts. Such programs are often launched
from console command-lines, and perform tasks such as processing text
files and launching other programs. Python programs can serve such
roles, but this is just one of dozens of common Python application
domains. It is not just a better shell script language.
- Control language
-
A "glue" layer used to control
and direct
(i.e., script) other application components. Python programs are
indeed often deployed in the context of a larger application. For
instance, to test hardware devices, Python programs may call out to
components that give low-level access to a device. Similarly,
programs may run bits of Python code at strategic points, to support
end-user product customization, without having to ship and recompile
the entire system's source code.
Python's simplicity makes it a naturally flexible
control tool. Technically, though, this is also just a common Python
role; many Python programmers code standalone scripts, without ever
using or knowing about any integrated components.
- Ease of use
-
A simple language used for coding tasks quickly. This is probably the
best way to think of Python as a scripting language. Python allows
programs to be developed much quicker than compiled languages like
C++. Its rapid development cycle fosters an exploratory, incremental
mode of programming that has to be experienced to be appreciated.
Don't be fooled, though—Python is not just for
simple tasks. Rather, it makes tasks simple, by its ease of use and
flexibility. Python has a simple feature set, but allows programs to
scale up in sophistication as needed.
So, is Python a scripting language or not? It depends on whom you
ask. In general, the term scripting is probably best used to describe
the rapid and flexible mode of development that Python supports,
rather than a particular application domain.
|