On Sat, Mar 20, 2021 at 8:03 PM Guido van Rossum email@example.com wrote:
The operator module is also C.
(In my 2018 PR, I was able to add the Python implementations of `aiter` and `anext` to Lib/operator.py, right above where it does "from _operator import *" toward the bottom of the file. I interpreted this pattern there to mean "shadow Python implementations with C implementations where available, but otherwise it's okay to use the Python implementations above". Is that right?)
Dan also suggested freezing the Python implementations into the binary as a way of keeping their implementations in Python, but in builtins rather than operator.
I am pleading to remove the 2nd arg to aiter, which should simplify the code.
Done in the latest revision of https://github.com/python/cpython/pull/23847. That does indeed simplify the patch significantly, nice.
All checks are passing. Yury or any other core developers, would you like to merge this now?
Thanks again, everyone.
--Josh, Dan, and Justin
 The latest revision adds the following to the `aiter` docs:
Unlike the :func:`iter` builtin, :func:`aiter` has no 2-argument variant. Often, this variant can be replaced with assignment expressions::
while chunk := await sock.read(CHUNK_SIZE): ...
I think when I originally worked on this in 2018, PEP 572 had only just been approved. :-)