Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

Commit 2ac4557

Browse files
committed
Add more explanation to Twisted section.
1 parent e117724 commit 2ac4557

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

twisted.rst

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,39 @@
22
Learn asyncio if you come from Twisted
33
++++++++++++++++++++++++++++++++++++++
44

5-
`Twisted project <https://twistedmatrix.com/trac/>`_.
5+
The `Twisted project <https://twistedmatrix.com/trac/>`_ is probably one of the
6+
oldest libraries that supports asynchronous programming in Python.
7+
It has been used by many programmers to develop a variety of applications.
8+
It supports many network protocols and can be used for many different
9+
types of network programming.
10+
In fact, asyncio was heavily inspired by Twisted.
11+
The expertise of several Twisted developers had been incorporated in
12+
asyncio.
13+
Soon, there will be a version of Twisted that is based on asyncio.
14+
615

716

817
Rosetta Stone
918
=============
1019

20+
This tables shows equivalent concepts in Twisted and asyncio.
21+
1122
======================== ==================================
1223
Twisted asyncio
1324
======================== ==================================
14-
Deferred asyncio.Future
15-
deferToThread(func) loop.run_in_executor(None, func)
16-
@inlineCallbacks async def
17-
reactor.run() loop.run_forever()
25+
``Deferred`` ``asyncio.Future``
26+
``deferToThread(func)`` ``loop.run_in_executor(None, func)``
27+
``@inlineCallbacks`` ``async def``
28+
``reactor.run()`` ``loop.run_forever()``
1829
======================== ==================================
1930

2031

2132
Deferred example
2233
================
2334

35+
This small example shows two equivalent programs, one implemented in Twisted
36+
and one in asyncio.
37+
2438
+--------------------------------------------------+--------------------------------------------------+
2539
| Twisted | asyncio |
2640
+==================================================+==================================================+

0 commit comments

Comments
 (0)