Compact syntax for 0-matrix?

Kirby Urner urner at alumni.princeton.edu
Mon May 29 01:13:12 EDT 2000


Alexander <alecdem at mit.edu> wrote:

>
>
>You can use Numeric Python to do that.
>it has function "zeros" for doing that.
>

Yes, I know, but I don't want to depend on
Numeric Python in this instance.  The point
in this context is transparency:  students
need to see everything.

Here's another function I like OK:

   def zeromatrix(n,m):
        output = []
        for i in range(n): output.append([0]*m)
        return output

Kirby




More information about the Python-list mailing list