# Pitch The current code path for adding and removing asyncio readers and writers always has to do a `try` `except KeyError` to add a new reader/writer https://github.com/python/cpython/blob/b3648f036e502db7e7da951ec4eb1f205cb3d74e/Lib/asyncio/selector_events.py#L316 For use cases where readers are added and removed frequently (hard to change the design without breaking changes) this adds up quickly. <img width="1321" alt="Screenshot 2023-07-07 at 8 22 45 AM" src="https://github.com/python/cpython/assets/663432/c0583d58-e342-40f0-ac3c-77795610f84f"> <!-- gh-linked-prs --> ### Linked PRs * gh-106528 <!-- /gh-linked-prs -->
Pitch
The current code path for adding and removing asyncio readers and writers always has to do a
tryexcept KeyErrorto add a new reader/writercpython/Lib/asyncio/selector_events.py
Line 316 in b3648f0
For use cases where readers are added and removed frequently (hard to change the design without breaking changes) this adds up quickly.
Linked PRs