Mark Wooding wrote:
What [x] * n does is make a list, whose length is n, and all of whose entries are precisely the value x. If x itself is a list, then you get an outer list all of whose entries are the /same/ inner list
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)] If you're computing heavily with arrays, you might also consider using numpy arrays instead of lists. -- Greg -- http://mail.python.org/mailman/listinfo/python-list