asyncstdlib icon indicating copy to clipboard operation
asyncstdlib copied to clipboard

Switch itertools.groupby closures to class implementation

Open maxfischer2781 opened this issue 3 years ago • 0 comments

The itertools.groupby implementation currently follows the standard library pure-python implementation. This heavily uses closures to share state between three interlocked async generator functions.

This is confusing for code scanning (https://github.com/maxfischer2781/asyncstdlib/security/code-scanning/85, https://github.com/maxfischer2781/asyncstdlib/security/code-scanning/84) and admittedly for humans as well.

In the interest of maintainability, the code should be refactored with the goal of being more readable/understandable. Similar to other cases, prominently itertools.tee, a class based approach seems appropriate.

maxfischer2781 avatar Nov 22 '22 10:11 maxfischer2781