Chapter 5. Reading Great Code

Programmers read a lot of code. One of the core tenets behind Python’s design is readability, and one secret to becoming a great programmer is to read, understand, and comprehend excellent code. Such code typically follows the guidelines outlined in “Code Style” and does its best to express a clear and concise intent to the reader.

This chapter shows excerpts from some very readable Python projects that illustrate topics covered in Chapter 4. As we describe them, we’ll also share techniques for reading code.1

Here’s a list of projects highlighted in this chapter in the order they will appear:

  • HowDoI is a console application that searches the Internet for answers to coding questions, written in Python.

  • Diamond is a Python daemon2 that collects metrics and publishes them to Graphite or other backends. It is capable of collecting CPU, memory, network, I/O, load and disk metrics. Additionally, it features an API for implementing custom collectors to gather metrics from almost any source.

  • Tablib is a format-agnostic tabular dataset library.

  • Requests is a HyperText Transfer Protocol (HTTP) library for human beings (the 90% of us who just want an HTTP client that automatically handles password authentication and complies with the half-dozen standards to perform things like a multipart file upload with one function call).

  • Werkzeug started as a simple collection of various utilities for Web Service Gateway Interface (WSGI) applications and has become ...

Get The Hitchhiker's Guide to Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.