Skip to content

Whetting Your Appetite

If you spend any real time on a computer, you've probably had the thought: there has to be a better way to do this. Maybe you need to rename 200 files. Maybe you want to pull data out of a website every hour. Maybe you built a spreadsheet that's getting unwieldy and wish it could just do the calculation for you.

That's exactly what Python is for.


What Python Is

Python is a general-purpose programming language designed to be easy to read and write. It runs on Windows, macOS, Linux, and basically anywhere else. It's free, open source, and has been around since 1991 — so it's battle-tested, not experimental.

It's the most popular language in the world right now, and for good reason:

  • Web backends: Instagram, YouTube, Dropbox, and Reddit all run Python.
  • Data science and machine learning: NumPy, pandas, scikit-learn, TensorFlow, PyTorch — all Python.
  • Automation and scripting: Anything repetitive, Python can automate.
  • Scientific computing: NASA, CERN, and basically every research institution uses Python.
  • System administration: Ansible, Fabric, and countless devops tools are Python.

Why Python — Not Something Else?

If you already know another language (JavaScript, Java, C++), you might wonder why you'd bother learning Python. Here's the honest pitch:

It does more with less code. Compare reading a file and printing each line:

with open("data.txt") as f:
    for line in f:
        print(line.strip())
import java.io.*;
public class ReadFile {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader("data.txt"));
        String line;
        while ((line = reader.readLine()) != null) {
            System.out.println(line.trim());
        }
        reader.close();
    }
}
#include <iostream>
#include <fstream>
#include <string>
int main() {
    std::ifstream f("data.txt");
    std::string line;
    while (std::getline(f, line)) {
        std::cout << line << "\n";
    }
}

Python's version is shorter, reads almost like English, and handles the file close automatically (via the with block). This is not a cherry-picked example — it's representative of how Python code feels across the board.


Python Is Interpreted

Python is an interpreted language. There's no compile step — you write code, you run it:

python3 hello.py

Or interactively, line by line:

$ python3
>>> print("Hello")
Hello
>>> 2 + 2
4

This interactive shell (called the REPL — Read-Eval-Print Loop) is one of Python's most useful features for experimenting and learning.


The Standard Library Is Enormous

Python ships with a massive standard library. Without installing anything extra, you can:

  • Read and write files, zip archives, CSV, JSON, TOML, INI files
  • Make HTTP requests and run an HTTP server
  • Work with dates, times, and timezones
  • Parse and generate XML, HTML
  • Write multithreaded or multiprocessing programs
  • Send email, read FTP, talk to databases
  • Run unit tests, profile code, debug interactively
  • Parse command-line arguments, work with the OS

The standard library is so complete that Python's design philosophy is sometimes called "batteries included."


And the Ecosystem Beyond

PyPI (the Python Package Index) hosts over 500,000 packages. Whatever you need to do — image processing, web scraping, machine learning, game development, 3D graphics, audio processing — there's a package for it. Installing is one command:

pip install requests numpy pandas

What Python Is Not Great For

Honest answer: Python is slow for raw number-crunching compared to C, C++, or Rust. If you're writing a game engine, an OS kernel, or embedded firmware, Python isn't the tool.

But for everything else — scripting, web, data, automation, tools, APIs — Python's speed-of-development advantage far outweighs the runtime speed difference. And where you genuinely need speed (matrix math, image processing), the libraries (NumPy, OpenCV) call into C under the hood, so you get C-speed where it matters.


Ready to Start?