the.bay.news

Add the stop_exception parameter to iter() and aiter()

Discussions on Python.org
Add the stop_exception parameter to iter() and aiter()
Add the stop_exception parameter to iter() and aiter() The two-argument iter() only covers callables which report exhaustion by returning a special value. Many callables raise an exception instead — list.pop() and deque.popleft() raise IndexError, dict.popitem() raises KeyError, queue.get_nowait() raises Empty, asyncio.Queue.get() raises QueueShutDown after shutdown — and for them the sentinel form cannot be used at all. Every such loop is written by hand today. This has been asked for several ...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.