4

asyncio is an event driven core lib of python 3.4. I know twisted, a similar lib for asyncio, implements the Reactor pattern, but what kind of pattern does asyncio implement?

2 Answers 2

2

Well, it uses reactor for posix. Windows implementation has proactor event loop too.

Sign up to request clarification or add additional context in comments.

4 Comments

Are windows_events.py and unix_events.py good starting points for investigation?
No. unix_events.py is about signal handling and subprocess execution. windows_events.py is overcomplicated due Windows io completion port nature. As the best starting point I recommend selector_events.py.
@AndrewSvetlov you're referring to this selector_events.py? Would you point out the proactor and reactor patterns in the code that you referred to?
Reactor pattern is used for every loop implementation except asyncio.windows_event:ProactorEventLoop obviously.
1

As @AndrewSvetlov answered, Python already will select the most performant selector for you, depending on your operating system. Different selector event loops will be, ensuring to get the tightest loop, the most performant selector available on your operating system. So it implements both patterns.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.