Skip to content

Commit 72dcb2d

Browse files
authored
Added an example code to explain aiter()
1 parent 5736e53 commit 72dcb2d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

docs/builtin/aiter.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,21 @@ description: Return an asynchronous iterator for an asynchronous iterable. Equiv
1414
From the <a target="_blank" href="https://docs.python.org/3/library/functions.html#aiter">Python 3 documentation</a>
1515
</base-disclaimer-title>
1616
<base-disclaimer-content>
17+
<br/>
1718
Return an asynchronous iterator for an asynchronous iterable. Equivalent to calling x.__aiter__().
1819
</base-disclaimer-content>
1920
</base-disclaimer>
2021

21-
<!-- remove this tag to start editing this page -->
22-
<empty-section />
23-
<!-- remove this tag to start editing this page -->
22+
<base-disclaimer>
23+
<base-disclaimer-content>
24+
<br/>
25+
aiter() is an async equivalent of iter(). <br/> Here's an example showing the use of aiter()
26+
</base-disclaimer-content>
27+
</base-disclaimer>
28+
29+
```async def aitersync(iterable):
30+
results = []
31+
async for x in aiter(iterable):
32+
results.append(x)
33+
return iter(results)
34+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy