I recently came across a video by mcoding about Python iterators' unfortunate closing behaviour.
To sum up the video, when an iterator is interrupted we intuitively we would expect the exit of a context manager or a finally block to be called but that's not necessarily the case. For example …
read more