On Oct 9, 7:34 am, rusi <rustompm...@gmail.com> wrote:
> How about a 2-paren version?
>
> >>> x = [1,2,3]
> >>> reduce(operator.add,  [['insert', a] for a in x])
>
> ['insert', 1, 'insert', 2, 'insert', 3]

Or if one prefers the different parens on the other side:

>>> reduce(operator.add, (['insert', a] for a in x))
['insert', 1, 'insert', 2, 'insert', 3]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to