There
are a lot of prerequisites to fully understanding what makes Python special. As
we cover these things in the course, we will sometimes take a moment to compare
Python to other programming languages. But here is a brief overview of some
special things:
Python
is a dynamically typed language, and
it is strongly typed. We will cover
these concepts more in later modules, but for now: weakly typed languages allow
you to freely mix different types of data (like integers, floating point
numbers, and strings), while strongly typed languages do not allow as much
mixing. Dynamically typed languages try to figure out the types of variables
while the program is running, while statically typed languages require
programmers to specify the types of variables in code (so, in those languages,
you must say that your variable is a string, or an integer, et cetera).
The
Python community has a dictum called the principle
of least astonishment. This principle suggests that Python code should be
as close as possible to the way human beings think, expect, and communicate.
Because of this, Python is generally considered to be a very human friendly
language, relatively easy to learn, easy to write, and easy to read.
Most
languages use symbols (such as brackets and parentheses) to organize pieces of
code, and have very few rules about whitespace
(i.e. spaces, line breaks, indentation). Python relies heavily on whitespace to
organize code.
Python
is considered a high level language,
meaning there are a significant number of abstractions between Python code and
machine instructions. It has support for object-oriented
programming and functional
programming (two ways of abstracting the sequential, line-by-line style), but
the Python community is unusual for mostly preferring procedural programming (the sequential, line-by-line style).
Finally, Python has excellent built in libraries, which are extra tools for doing a variety of things. In most programming languages, it takes intermediate to advanced skills to make a simple web server, or to grab a web page and read it into a string. In Python, each of these things can be done in one line of code.