Skip to content

Commit

Permalink
clarify this is a simplified example
Browse files Browse the repository at this point in the history
Change-Id: I3a9a4f8562d57091031386785354c32ec316cd88
  • Loading branch information
zzzeek committed Jun 27, 2024
1 parent e020f39 commit dd70ec7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/build/synopsis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ other greenlets anywhere within the execution of that greenlet::

Above, the ``send_receive_logic()`` function is called within a greenlet that
itself links to a parent greenlet that's local to the :func:`.async_def`
callable (this is the normal way that greenlet works)::
function (this is the normal way that greenlet works). Below we illustrate
a **simplified** version of :func:`.async_def` that does not include details
like exception handling and other robustness regarding arguments::

async def async_def(
fn: Callable[..., _T],
Expand Down Expand Up @@ -273,5 +275,7 @@ True, then we know the function completed; we return the result!
# no more awaits; so this is the result!
return result


Minus error handling and some other robustness details, that's the whole thing!
The real function has a more elements within the loop to accommodate for
exceptions thrown from the callable, as well as other features to check that
awaitables ran if this was expected. But minus those details, the single loop
is pretty much the whole thing!

0 comments on commit dd70ec7

Please sign in to comment.