pytoolz / toolz

A functional standard library for Python.
http://toolz.readthedocs.org/
Other
4.66k stars 259 forks source link

Add itertoolz.flatten #547

Open groutr opened 2 years ago

groutr commented 2 years ago

An implementation of javascript's Array.flat() (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat#use_generator_function) More flexible than the flatten recipe in itertools.

eriknw commented 2 years ago

Cool! yield from syntax from Python 3.3 definitely makes this nicer.

Some questions:

flatten seems like a useful, well-named function.

groutr commented 2 years ago

Yes, a very good use case for yield from. Some answers:

@eriknw I really appreciate the feedback.

groutr commented 2 years ago

@eriknw I think this is ready for another review.

groutr commented 1 year ago

ping @eriknw