János Juhász wrote:
> Hi,
> 
> I can't imagine how this could be made with list comprehension.
> 
>>>>import operator
>>>>a = (([1],[2],[3,31,32],[4]), ([5],[6],[7, 71, 72]), ([8],[9]))
>>>>reduce(operator.add, a) # it makes a long list now
> 
> Is it possible to substitute reduce with comprehension anyway ?

Not that I know. Why are you trying to eliminate reduce()? If it is for 
compatibility with Python 3.0, PEP 3000 recommends replacing reduce() with an 
explicit loop.
http://www.python.org/peps/pep-3000.html#built-in-namespace

Kent
-- 
http://www.kentsjohnson.com

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to