코루틴(Coroutine)
코루틴 (Coroutine) 코루틴 (Coroutine) 은 복잡한 비동기 작업을 간단하고 효율적으로 처리할 수 있게 해주는 프로그래밍 개념이다. 프로그램의 실행 흐름을 제어할 수 있는 프로그래밍 구성 요소이다. 일반적인 함수와 달리, 코루틴은 실행을 일시 중단하고 재개할 수 있으며, 여러 진입점과 종료점을 가질 수 있다. 이는 마치 대화하는 것처럼, 실행을 주고받을 수 있다는 특징이 있다. 1 2 3 4 5 6 7 8 9 10 11 12 13 # Python에서의 간단한 코루틴 예제 async def simple_coroutine(): print("코루틴 시작") await asyncio.sleep(1) # 중단점 print("1초 후 재개") await asyncio.sleep(1) # 다른 중단점 print("또 1초 후 재개") # 코루틴 실행 async def main(): await simple_coroutine() asyncio.run(main()) https://medium.com/@turxan.dunya97/simple-explanation-what-is-coroutines-in-programming-d01e0ddf6f06 ...