Getting Started in Python#

“Python has gotten sufficiently weapons grade that we don’t descend into R anymore. Sorry, R people. I used to be one of you but we no longer descend into R.” – Chris Wiggins

What’s Python?#

Python is a general-purpose programming language conceived in 1989 by Dutch programmer Guido van Rossum.

Python is free and open source, with development coordinated through the Python Software Foundation.

Python has experienced rapid adoption in the last decade and is now one of the most commonly used programming languages.

Popular textbooks on Python programming include:

Introduction to Computation and Programming Using Python, Second Edition With Application to Understanding Data By John V. Guttag

Python Crash Course, 3rd Edition A Hands-On, Project-Based Introduction to Programming by Eric Matthes

Common Uses#

Python is a general-purpose language used in almost all application domains such as

  • communications

  • web development

  • CGI and graphical user interfaces

  • game development

  • multimedia, data processing, security, etc., etc., etc.

Python is beginner-friendly and routinely used to teach computer science and programming in top computer science programs.

Python is particularly popular within the scientific and data science communities.

It is steadily replacing familiar tools like Excel in the fields of finance and banking.

Relative Popularity#

The following chart, produced using Stack Overflow Trends, shows one measure of the relative popularity of Python

plot showing increasing popularity of python relative to matlab

Fig. 1 Python’s increasing popularity over time.#

The figure indicates not only that Python is widely used but also that adoption of Python has accelerated significantly since 2012.

This is driven at least in part by uptake in the scientific domain, particularly in rapidly growing fields like data science.

For example, the popularity of pandas, a library for data analysis with Python has exploded, as seen here.

(The corresponding time path for MATLAB is shown for comparison)

plot showing increasing popularity of pandas relative to matlab

Fig. 2 Pandas increasing popularity over time.#

Note that pandas takes off in 2012, which is the same year that we see Python’s popularity begin to spike in the first figure.

Overall, it’s clear that


Python is a high-level language suitable for rapid development.

It has a relatively small core language supported by many libraries. For instance run the following The Zen of Python (poem) online.

Multiple programming styles are supported (procedural, object-oriented, functional, etc.)

Python is interpreted rather than compiled.

Syntax and Design#

One nice feature of Python is its elegant syntax — we’ll see many examples later on.

Elegant code might sound superfluous but in fact it’s highly beneficial because it makes the syntax easy to read and easy to remember.

Remembering how to read from files, sort dictionaries and other such routine tasks means that you don’t need to break your flow in order to hunt down correct syntax.

Closely related to elegant syntax is an elegant design.

Features like iterators, generators, decorators and list comprehensions make Python highly expressive, allowing you to get more done with less code.

Namespaces improve productivity by cutting down on bugs and syntax errors.

Scientific Programming#

Python has become one of the core languages of scientific computing.

It’s either the dominant player or a major player in

Its popularity in economics is also beginning to rise.


The above lesson was pulled directly from work by Thomas J. Sargent & John Stachurski