PyLings:Python 練習題與學習工具
PyLings: Solve Exercises and Learn Python
重點導讀
PyLings 是一個模仿 Rustlings 的 Python 練習工具,提供 35 個暖身題與 20 個面試題,支援即時測試與自動化練習。
- 題目數量:35 個暖身題 + 20 個面試題,涵蓋字串、集合、函式、類別、迭代器、裝飾器、非同步等主題。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
正文
Python interview practice, rustlings-style: 35 warm-ups + 20 interview exercises, from easy to hard. Python 3.14, no dependencies.
Start
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
| Level | Folder | What's inside |
|---|---|---|
| Warm-up | exercises/0_warmups/ |
35 short "fix this" tasks: strings, collections, functions, classes, iterators, decorators, asyncio… |
| Middle | exercises/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 |
| Senior | exercises/3_senior/ |
11–17: contextmanager, single-flight cache, circuit breaker, external sort, async map, worker pool, bug hunt |
| Staff | exercises/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
- Don't open
solutions/until the tests pass. - Name the edge cases before you write code.
- When the tests pass, answer the Discussion questions at the end of the exercise. That's what interviewers ask.
Without pylings
python3 -m unittest discover -s tests -p "test_ex05*" -vCheck the reference solutions:
SOLUTIONS=1 python3 -m unittest discover -s tests
來源: Hacker News (official RSS) (github.com)
開啟原文