Skip to content

Commit eb1b8b3

Browse files
committed
with continuations docstring: add note about scoping
1 parent b94d79a commit eb1b8b3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎unpythonic/syntax/tailtools.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,13 @@ def myfunc(a, b, cc):
351351
Inside a ``with continuations:`` block, the ``call_cc[]`` statement
352352
captures a continuation. (It is actually a macro, for technical reasons.)
353353
354+
Capturing a continuation introduces a scope boundary. The continuation
355+
captured by `call_cc` (i.e. the rest of the function body after the
356+
`call_cc` statement) is a new scope, and the assignment part of the
357+
`call_cc` statement takes effect in that new scope. Under the hood,
358+
the assignment from the `call_cc` is implemented as function parameters;
359+
the continuation is a function.
360+
354361
For various possible program topologies that continuations may introduce, see
355362
the clarifying pictures under ``doc/`` in the source distribution.
356363

0 commit comments

Comments
 (0)