On Thu, Aug 1, 2019 at 10:49 AM Eli Berkowitz <eliberkow...@gmail.com> wrote:
> In terms of an argument for why it should be included, for most Python > users the itertools recipes remain unseen. I consider myself relatively > fluent in Python (not compared to y'all of course) and hadn't seen them > until I started this thread. If I had to hazard a guess, they're probably > unused by 95%+ of the Python userbase. > Having a function like consume as a builtin or part of a library widely > increases visibility, and as it's a clean and efficient way of running an > expression on a collection of data I think it's worth it especially as it > has very little overhead. > > Also, given that `consume_iterator` is already in CPython in the > collections module as a special case for `collections.deque(..., maxlen=0)` > (and maybe some other things), I'm guessing it would not be hard at all to > add consume to the itertools module, though I'll be honest I have no idea > how Python's underlying C code fits together at the module level. > > https://github.com/python/cpython/blob/master/Modules/_collectionsmodule.c#L368 > You can open an issue at bugs.python.org to make consume() a top-level itertools function, but check it hasn't been asked for before.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ZYABCLWUENLXUNECEZTUZVFJQHSNOERX/ Code of Conduct: http://python.org/psf/codeofconduct/