Gary Herron wrote:
 >>> A = [1,2,3]
 >>> B = [4,5,6]
 >>> C = [7,8,9]

 >>> A+B+C
[1, 2, 3, 4, 5, 6, 7, 8, 9]

 >>> sum([A,B,C], [])
[1, 2, 3, 4, 5, 6, 7, 8, 9]

Careful now, this can be very slow. sum uses __add__, not __iadd__, which gives this approach quadratic worst-case runtime.

- Anders
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to