On Oct 15, 2016 6:42 PM, "Steven D'Aprano" email@example.com wrote:
doesn't make sense, it is invalid. Call it something else: the new "flatten" operator:
[^t for t in iterable]
for example, which magically adds an second invisible for-loop to your
This thread is a lot of work to try to save 8 characters in the spelling of `flatten(it)`. Let's just use the obvious and intuitive spelling.
We really don't need to be Perl. Folks who want to write Perl have a perfectly good interpreter available already.
The recipes in itertools give a nice implementation:
def flatten(listOfLists): "Flatten one level of nesting" return chain.from_iterable(listOfLists)