[Python-ideas] Proposal: flatten multi-nested list/tuple/set and other certain class/type.

2018-04-12 Thread delta114514
I thought that itertools.chain.from_iterable isn't useful. cuz this only allow "single-nested iterable -- this will raise error when arg has non-nested element--" like below:: >>> from itertools import chain >>> chain.from_iterable([1]) >>> list(_) Traceback (most recent call last): File "",

[Python-ideas] flatten multi-nested list/set/tuple and certain types.

2018-04-12 Thread delta114514
I thought that itertools.chain.from_iterable isn't useful. cuz this only allow "single-nested iterable -- this will raise error when arg has non-nested element--" like below:: >>> from itertools import chain >>> chain.from_iterable([1]) >>> list(_) Traceback (most recent call last): File "",