fluttersmith/py-snippetsGitHub ↗

Python snippets that still pass.

40 small, typed functions with plain explanations. Every example on the page is a doctest, run on Python 3.11 to 3.14.

40 snippets, tested on 3.11–3.14. Last check: 1 Oct 2026.
Python 3.11 · 3.12 · 3.13 · 3.14 · 133/133 examples passing

python✓ 2 doctests · 3.11–3.14
passed on Python 3.11 to 3.14: >>> chunk_into_n([1, 2, 3, 4, 5, 6, 7], 4)[[1, 2], [3, 4], [5, 6], [7]]passed on Python 3.11 to 3.14: >>> slugify("  Crème brûlée -- 2nd_edition ")'creme-brulee-2nd-edition'

pysnippets.lists

Splitting, grouping, de-duplicating and comparing sequences

pysnippets.dicts

Inverting, searching, mapping and sorting mappings

pysnippets.strings

Slugs, naming cases, words and character checks

pysnippets.numbers

Conversions, ranges and number checks

pysnippets.dates

Date ranges, calendar months and weekdays