Separation of concerns assigns distinct responsibilities to separate components or computations. In asynchronous subprocess communication, coupling output reading with input writing becomes difficult to follow as I/O grows more complex. section 13.2
Coordinating an interactive subprocess
An output-consumer coroutine reads standard output until it sees the expected prompt, then sets an Event. An input-writer coroutine waits for that event, writes input, drains the stream, and clears the event. Running both coroutines with gather gives each one clear responsibility. section 13.2
Listing 13.9 Echoing user input
username = input('Please enter a username: ')
print(f'Your username is {username}')
Inspect the coroutine-based implementation that separates prompt detection from input writing. section 13.2





















