gitmyhub

one-python-craftsman

★ 7.2k updated 2y ago

来自一位 Pythonista 的编程经验分享,内容涵盖编码技巧、最佳实践与思维模式等方面。

A Chinese-language series of 16 practical Python articles teaching clean code, SOLID design principles, and real engineering practices, also published as a physical book.

Pythonsetup: easycomplexity 1/5

One Python Craftsman is a collection of Chinese-language articles sharing practical Python programming knowledge, written by an experienced Python developer who goes by piglei. The repository covers coding techniques, best practices, and ways of thinking about software design problems. The articles have since been expanded and published as a physical book titled Python Craftsman: Cases, Techniques and Engineering Practices.

The series is organized into sixteen topics. Early articles focus on foundational choices: how to name variables clearly, how to write clean conditional branches, and how to work effectively with Python data structures like lists, dictionaries, and sets. Later articles cover function design, exception handling, loops, decorators, and how Python module imports work, including the common problem of circular imports.

A substantial portion of the series is devoted to object-oriented programming principles, specifically the SOLID design principles applied to Python code. These chapters walk through common mistakes and show how to refactor code to follow rules like keeping each class responsible for a single concern, making code open to extension without modification, and decoupling high-level logic from low-level implementation details.

The README is written in Chinese, and the articles themselves are also in Chinese, making this resource primarily useful for Mandarin-reading Python developers rather than a general international audience. Three chapters are available as free reading on the author book website, and the rest are in the linked GitHub files. A mirrored website built by a community contributor also hosts all the articles in a more readable format than browsing raw Markdown files on GitHub.

Where it fits