On Sat, Mar 20, 2021 at 8:03 PM Guido van Rossum <gu...@python.org> 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.[1] All checks are passing. Yury or any other core developers, would you like to merge this now? Thanks again, everyone. --Josh, Dan, and Justin [1] 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. :-)
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/JN3QVRDD3GZILCL7HTC6PPQL5N7J2NSA/ Code of Conduct: http://python.org/psf/codeofconduct/