PyLings 发布 Rustlings 风格 Python 面试练习工具

原标题:PyLings: Solve Exercises and Learn Python
38AI 研判分

PyLings 是一个零依赖的 Python 3.14 命令行练习工具,仿照 rustlings 的交互模式,提供 35 个热身题与 20 道从中级到 Staff 级的面试编程题,保存即自动重跑测试。题目覆盖迭代器、LRU 缓存、限流器、断路器、异步任务池等工程场景,并附带参考答案与讨论题。

报道正文

本文目录4 个章节

PyLings 🐍

Python interview practice, rustlings-style: 35 warm-ups + 20 interview exercises, from easy to hard. Python 3.14, no dependencies.

Start

BASH
python3 -m pylings

It opens the next exercise and re-runs its tests every time you save.

Keys: n next · h hint · r re-run · l list · c check all · x reset · s solution · q quit

Exercises

LevelFolderWhat's inside
Warm-upexercises/0_warmups/35 short "fix this" tasks: strings, collections, functions, classes, iterators, decorators, asyncio…
Middleexercises/1_middle/01–06: iterator utils, LRU cache, retry decorator, bug hunt, KV transactions, log report
Middle+exercises/2_middle_plus/07–10: Money, rate limiter, event bus, task graph
Seniorexercises/3_senior/11–17: contextmanager, single-flight cache, circuit breaker, external sort, async map, worker pool, bug hunt
Staffexercises/4_staff/18–20: generator event loop, mini pydantic, DI container

Solutions are in solutions/ (same layout). Interview questions are in questions/middle.md and questions/senior.md.

Tips

  1. Don't open solutions/ until the tests pass.
  2. Name the edge cases before you write code.
  3. When the tests pass, answer the Discussion questions at the end of the exercise. That's what interviewers ask.

Without pylings

BASH
python3 -m unittest discover -s tests -p "test_ex05*" -v

Check the reference solutions:

BASH
SOLUTIONS=1 python3 -m unittest discover -s tests