@@ -24,7 +24,7 @@ async def spawn_n_usage(todo=[range(1,51), range(51,101), range(101,200)]):
2424 # Returns quickly for all tasks, does not wait for pool space. 
2525 # Workers are not spawned, they wait for pool space in their 
2626 # own background tasks. 
27-  fut  =  await   pool .spawn_n (worker (i ))
27+  fut  =  pool .spawn_n (worker (i ))
2828 futures .append (fut )
2929 # At this point not a single worker should start. 
3030
@@ -99,7 +99,7 @@ async def cb(res, err, ctx): # callback
9999
100100 async  with  AioPool (size = 2 ) as  pool :
101101 for  i  in  todo :
102-  fut  =  await   pool .spawn_n (wrk (i ), cb , (pool , i ))
102+  fut  =  pool .spawn_n (wrk (i ), cb , (pool , i ))
103103 futures .append (fut )
104104
105105 results  =  []
@@ -125,7 +125,7 @@ async def cb(res, err, ctx): # callback
125125
126126async  def  exec_usage (todo = range (1 ,11 )):
127127 async  with  AioPool (size = 4 ) as  pool :
128-  futures  =  await   pool .map_n (worker , todo )
128+  futures  =  pool .map_n (worker , todo )
129129
130130 # While other workers are waiting or active, you can "synchronously" 
131131 # execute one task. It does not interrupt others, just waits for pool 
@@ -147,9 +147,9 @@ async def wrk(*arg, **kw):
147147
148148 pool  =  AioPool (size = 2 )
149149
150-  f_quick  =  await   pool .spawn_n (aio .sleep (0.1 ))
151-  f12  =  await  pool .spawn (wrk ()), await   pool .spawn_n (wrk ())
152-  f35  =  await   pool .map_n (wrk , range (3 ))
150+  f_quick  =  pool .spawn_n (aio .sleep (0.1 ))
151+  f12  =  await  pool .spawn (wrk ()), pool .spawn_n (wrk ())
152+  f35  =  pool .map_n (wrk , range (3 ))
153153
154154 # At this point, if you cancel futures, returned by pool methods, 
155155 # you just won't be able to retrieve spawned task results, task 
@@ -184,15 +184,15 @@ async def details(todo=range(1,11)):
184184 # This code: 
185185 f1  =  []
186186 for  i  in  todo :
187-  f1 .append (await   pool .spawn_n (worker (i )))
187+  f1 .append (pool .spawn_n (worker (i )))
188188 # is equivalent to one call of `map_n`: 
189-  f2  =  await   pool .map_n (worker , todo )
189+  f2  =  pool .map_n (worker , todo )
190190
191191 # Afterwards you can await for any given future: 
192192 try :
193193 assert  3  ==  await  f1 [2 ] # result of spawn_n(worker(3)) 
194-  except  Exception   as   e :
195-  # exception happened in worker (or  CancelledError) will be re-raised 
194+  except  BaseException :
195+  # exception happened in worker (including  CancelledError) will be re-raised 
196196 pass 
197197
198198 # Or use `asyncio.wait` to handle results in batches (see `iterwait` also): 
0 commit comments