Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
For large n, I don't think a C implementation would do much better than your Python version where most of the work is done by chain() and islice() which are already in C. The best that could be done is to eliminate the overhead of chain() which is likely about a third of the cost. For smaller n, the grouper recipe is already very close to optimal. ---------- assignee: -> rhettinger _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46718> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com