Stream

Small thing that clicked today — using pathlib instead of os.path makes filesystem code read almost like English:

from pathlib import Path

drafts = [p for p in Path("content").rglob("*.md")
          if "draft: true" in p.read_text()]

print(f"{len(drafts)} unpublished posts")

Been writing Python for years and only recently made the switch. Not going back.

2025-02-27 14:00 · programming