Chapter 1: Introducing Python 1.3: Comparing scripting vs. programming4
not seem like a big advantage, but the user community for Python is large,
in part due to its cross-platform nature.
It’s interpreted: Many programming languages require that a program
be converted from the source language, such as C++ or Visual Basic, into
binary code that the computer can understand. This requires a compiler
with various options. Python is an interpreted language, which means it
does not need compilation to binary code before it can be run. You simply
run the program directly from the source code, which makes Python easier
to work with and much more portable than other programming languages.
It’s object oriented: Python is an object-oriented programming language.
An object-oriented program involves a collection of interacting objects, as
opposed to the conventional list of tasks. Many modern programming lan-
guages support object-oriented programming. ArcGIS is designed to work
with object-oriented languages, and Python qualies in this respect.
1.3: Comparing scripting vs. programming
Although Python is a programming language, it is often referred to as a
scripting language. So, what is the difference? In general, a scripting lan-
guage refers to automating certain functionality within another program,
while a programming language involves the development of more sophis-
ticated multifunctional applications. Scripting is a programming task that
allows you to connect diverse existing components to accomplish a new,
related task. Scripting is the “glue” that allows you to put various existing
elements together. Programming, on the other hand, allows you to build
components from scratch, as well as the applications that incorporate these
components. Languages that work with these low-level primitives and the
raw resources of the computer are referred to as system languages. Exam-
ples of system languages include C++ and the .NET languages. Scripting
languages use built-in higher-level functions and mask the detail a system
language deals with. Examples of scripting languages include Python, Perl,
PHP, and Ruby.
Esri, for example, relies primarily on C++ as the programming language
to create ArcGIS software and all the different components or objects, called
ArcObjects, that you nd in the software. You can then use C++ to write
your own software that utilizes these same ArcObjects as well as create
your own objects. However, you can also use scripting to access the existing
functionality of ArcGIS and connect functions in new ways to extend that
functionality.
One of the strengths of Python is that it is both a scripting and a pro-
gramming language, although it does not have quite the depth of a system
language like C++. You can use it for relatively simple scripts as well
as more advanced programming tasks. The focus of this book is writ-
ing Python scripts to carry out tasks in ArcGIS. Python can also be used
for application development, but these aspects of using Python are not