Introduction Python’s ThreadPoolExecutor’s context manager is a really neat way to run a bunch of (I/O) work in a thread pool, and then clean everything up when the context is exited. Something like this: 1 2 3 withThreadPoolExecutor()asexecutor:foriinrange(N):executor.submit(my_function,arg1,arg2) Where did my tasks go, attempt 1 Recently at work however, I had to debug a case where it appeared that it would discard tasks that had been submitted later.