Compact syntax for 0-matrix?

Alex cut_me_out at hotmail.com
Mon May 29 00:34:45 EDT 2000


How about this:

from copy import copy

def zeromatrix (n, m):
    line = n * [0]
    matrix = map (copy, m * [line])
    return matrix

I agree with the guy who said you should check out Numeric Python,
though.  It will probably work out to be more flexible for you, in the
long run.

Alex.



More information about the Python-list mailing list