« * K @trey.io

Trey Hunner @trey.io

2026-11-21 21:01 UTC

That setdefault call sets the key to an empty list ONLY if it's not already there. And since it returns the value, we can append right away. This gives me key defaulting when I need it while using a plain dictionary, so regular key lookups will still raise a KeyError.

A reply in a thread.

1 likes, 0 reposts, 1 replies

3 Next post4 More from @trey.ioBackBluesky home
☆ Save to home · 0 Home · Find · Games · Chat · AI · Setup