George Sakkis wrote: > Dustan wrote: > > > Alright, I can see I'm a bit outvoted here. I tried your suggestions > > and it worked fine. > > > > I'll also try to consider in the future that part of the problem might > > be lack of information conveyed on my part. > > If you insist on one-liners, it can be done without sum(), though it > probably doesn't buy you much in readability: > > from itertools import chain > [list(chain(*row)) for row in foo] > > By the way, if this was not a toy example and you're doing serious work > with n-dimensional arrays, make yourself a favor and install NumPy; > it's usually both faster and more elegant for array manipulations than > pure python.
1. I've already written pretty much all the code, and a complete rewrite would be rather difficult. 2. While I haven't taken a good look at NumPy, my intuition tells me it won't work with complex data types, which wouldn't work for me at all. Am I correct on that second one? -- http://mail.python.org/mailman/listinfo/python-list