Skip to content

Commit 1578048

Browse files
authored
Minor Example Code correction
Missing asyn. Modul prefix for NamedTask
1 parent d778ff4 commit 1578048

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PRIMITIVES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,15 +707,15 @@ The `NamedTask` constructor takes the name, the coro, plus any user positional
707707
or keyword args. The resultant instance can be scheduled in the usual ways:
708708

709709
```python
710-
await NamedTask('my foo', foo, 1, 2) # Pause until complete or killed
710+
await asyn.NamedTask('my foo', foo, 1, 2) # Pause until complete or killed
711711
loop = asyncio.get_event_loop() # Or schedule and continue:
712-
loop.create_task(NamedTask('my nums', foo, 10, 11)()) # Note () syntax.
712+
loop.create_task(asyn.NamedTask('my nums', foo, 10, 11)()) # Note () syntax.
713713
```
714714

715715
Cancellation is performed with:
716716

717717
```python
718-
await NamedTask.cancel('my foo')
718+
await asyn.NamedTask.cancel('my foo')
719719
```
720720

721721
When cancelling a task there is no need to check if the task is still running:

0 commit comments

Comments
 (0)