Python is an object-oriented high-level language. I began with the assumption that it would be simpler than C, and one practical task made the point quickly: extracting and subsetting font files. A font that started at around 20 MB could be split into smaller pieces, so a page might need to load only 1–2 MB. Using Python's fontTools subset command, I trimmed the font to the characters actually in use:

python -m fontTools.subset

The split looked roughly like this:

<table> <thead> <tr> <th>File</th> <th>Contents</th> </tr> </thead> <tbody> <tr> <td>core-cjk.woff2</td> <td>High-frequency Chinese characters</td> </tr> <tr> <td>core-misc.woff2</td> <td>Punctuation + ASCII</td> </tr> <tr> <td>fallback.woff2</td> <td>Low-frequency Chinese characters</td> </tr> </tbody> </table>

The output came in under 300 KB, and the site loaded noticeably faster. To try it, install the dependencies:

pip install fonttools brotli

These notes are uneven by design: sometimes detailed, sometimes just a reminder. They are better for review after some exposure than for a first lesson. If something is confusing, ask or use AI as an assistant—but aim to be an actual AI engineer, not an AI replacement.

Python in brief

Guido van Rossum—often called "Uncle Turtle" in Chinese Python circles—created Python over the Christmas holiday in 1989, partly to pass the time. Its main traits are:

  1. A very complete standard library covering networking, files, GUI, databases, text, and more. It is close to "food ready to eat," which makes it good for rapid development.
  2. A good fit for network applications, including websites and backend services.
  3. Slow runtime, and code cannot really be encrypted for distribution. PHP can be encoded; C can be compiled and packaged directly.

Installation and first check

I downloaded Python from the official Windows releases page. After installation, typing python in the terminal confirms that it is available:

Microsoft Windows [Version 10.0.26100.7840]
(c) Microsoft Corporation. All rights reserved.

C:\Users\29596>python
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> _

The IDLE window is the interactive programming interface:

IDLE interactive shell

A first test: print() outputs whatever string you put inside the parentheses.

print ("Hello, Python!")

Output:

Hello, Python!

print() can also output several strings separated by English commas; each comma appears as a space in the result. It can calculate and print too, for example print('100 + 200 =', 100 + 200). In that line, '100 + 200 =' is a string, not a mathematical formula.

Basic syntax notes

Source files use UTF-8 by default, and all strings are Unicode strings. If you need a different encoding, such as ISO-8859-1 or ASCII, specify it explicitly. Add an encoding declaration on the first or second line, using # -*- coding: <encoding name> -*-; for example, # -*- coding: utf-8 -*- or # coding=utf-8. This tells the Python interpreter how to parse all characters in the source file.

Python identifiers are made from letters, digits, and underscores.