Skip to content

Commit fad6381

Browse files
committed
v3 tutorial: correct asynchronous iterator __aiter__ method.
1 parent c7702d7 commit fad6381

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

v3/docs/TUTORIAL.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ class AsyncIterable:
12421242
self.data = (1, 2, 3, 4, 5)
12431243
self.index = 0
12441244

1245-
async def __aiter__(self):
1245+
def __aiter__(self): # See note below
12461246
return self
12471247

12481248
async def __anext__(self):
@@ -1266,6 +1266,9 @@ async def run():
12661266
print(x)
12671267
asyncio.run(run())
12681268
```
1269+
The `__aiter__` method was formerly an asynchronous method. CPython 3.6 accepts
1270+
synchronous or asynchronous methods. CPython 3.8 and MicroPython require
1271+
synchronous code [ref](https://github.com/micropython/micropython/pull/6272).
12691272

12701273
###### [Contents](./TUTORIAL.md#contents)
12711274

0 commit comments

Comments
 (0)