Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment:
Your example code doesn't behave the way you claim. my_list isn't changed, and `a` is a chain generator, not a list (without a further list wrapping). In any event, there is no reason to involve reduce here. chain already handles varargs what you're trying to do without involving reduce at all: a = list(itertools.chain(*my_list)) or if you prefer to avoid unnecessary unpacking: a = list(itertools.chain.from_iterable(*my_list)) Either way, a will be [1, 2, 3, 4], and my_list will be unchanged, with no wasteful use of reduce. ---------- nosy: +josh.r _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35043> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com