4 ms·
The fastest way to flatten a list in Python
- asplake 6y agoThere’s also the less obvious but still I think quite well-known recipe that uses itertools.chain. How it compares speed-wise I don’t know.
- __chrisconlan__ 6y agoDo you mind sharing? I'd like to add it here. https://github.com/chrisconlan/fast-python/blob/master/src/flatten_lists.py https://github.com/chrisconlan/fast-python/blob/master/src/f...