mysql
缓存
线程池
一,线程池:
上下文管理
import contextlib @contextlib.contextmanager def worker_state(state_list, worker_thread): state_list.append(worker_thread) try: print(state_list) yield #相当于return 返回值功能,但是不终止整个函数,只是跳出后重新执行函数 finally: state_list.remove(worker_thread) free_list = [] current_thread = "alex" with worker_state(free_list, current_thread): print(123)