@trey.ioTrey Hunner @trey.io
2026-11-21 21:01 UTC
Converting with dict(by_color) before returning works too, but if you're converting anyway, I'd consider using the setdefault method instead. I most often use defaultdict when I want EVERY key lookup to have a default, meaning a KeyError should NEVER happen. In my experience, that's pretty rare.
A reply in a thread.
1 likes, 0 reposts, 0 replies
3 Next post4 More from @trey.ioBackBluesky home