[issue35043] functools.reduce doesn't work properly with itertools.chain

2018-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Blech. Copy'n'paste error in last post: a = list(itertools.chain.from_iterable(*my_list)) should be: a = list(itertools.chain.from_iterable(my_list)) (Note removal of *, which is the whole point of from_iterable) -- ___

[issue35043] functools.reduce doesn't work properly with itertools.chain

2018-10-23 Thread Vasantha Ganesh Kanniappan
Vasantha Ganesh Kanniappan added the comment: You are right. It works now. I'm sorry for wasting your time. -- stage: -> resolved status: open -> closed ___ Python tracker __

[issue35043] functools.reduce doesn't work properly with itertools.chain

2018-10-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35043] functools.reduce doesn't work properly with itertools.chain

2018-10-22 Thread Josh Rosenberg
Josh Rosenberg 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 t

[issue35043] functools.reduce doesn't work properly with itertools.chain

2018-10-22 Thread Vasantha Ganesh Kanniappan
New submission from Vasantha Ganesh Kanniappan : I'm facing this issue in python 3.6.5 How to reproduce: my_list = [[1, 2], [3, 4]] a = reduce(itertools.chain, my_list) The output of `a' is [1, 2, 3, 4] as expected, but now my_list is [[1, 2, 3, 4], [3, 4]] -- components: Library (L