]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Clarify docs: `return` in generator is new in 3.3.
authorBen Darnell <ben@bendarnell.com>
Sat, 10 Jan 2015 15:47:19 +0000 (10:47 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 10 Jan 2015 15:47:19 +0000 (10:47 -0500)
docs/guide/async.rst

index 67b702dac08f6a1a4ba1b612265076c4d1753ef4..7430031f345f93cfeec159ac62da6df7592f9ed4 100644 (file)
@@ -110,4 +110,9 @@ the original synchronous version::
         response = yield http_client.fetch(url)
         raise gen.Return(response.body)
 
-The statement ``raise gen.Return(response.body)`` is an artifact of Python 2, in which generators aren't allowed to return values. To overcome this, Tornado coroutines raise a special kind of exception called a ``Return``. The coroutine catches this exception and treats it like a returned value. In Python 3, a ``return response.body`` achieves the same result.
+The statement ``raise gen.Return(response.body)`` is an artifact of
+Python 2 (and 3.2), in which generators aren't allowed to return
+values. To overcome this, Tornado coroutines raise a special kind of
+exception called a `.Return`. The coroutine catches this exception and
+treats it like a returned value. In Python 3.3 and later, a ``return
+response.body`` achieves the same result.