« * K @mvsamuel.bsky.social

Mike Samuel 🟣 @mvsamuel.bsky.social

2026-11-25 23:07 UTC

How do you write a defensive generator that closes its file handle when the loop `break`s after finding the line it needs? In JS, the loop "closes" its generator. Python dumps it on the floor. The generator closes when its pointer count reaches 0, inducing an exception and running finally blocks.

A reply in a thread.

1 likes, 0 reposts, 1 replies

3 Next post4 More from @mvsamuel.bsky.socialBackBluesky home
☆ Save to home · 0 Home · Find · Games · Chat · AI · Setup