Gregory Ewing <greg.ew...@canterbury.ac.nz> writes:

> A reasonably elegant way to fix this is to use list comprehensions
> for all except the innermost list:
>
>    ff = [[0.0]*5 for i in xrange(5)]

Yes, this is a good approach.  I should have suggested something like
this as a solution myself, rather than merely explaining the problem.

> If you're computing heavily with arrays, you might also consider
> using numpy arrays instead of lists.

Also a good idea.

-- [mdw]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to