defining multi dimensional array

bruce bedouglas at earthlink.net
Wed Jul 5 01:07:59 EDT 2006


do i need to import anything for this.. or is it supposed to work out of the
box..

and just what is it doing!!!!!

-bruce


-----Original Message-----
From: python-list-bounces+bedouglas=earthlink.net at python.org
[mailto:python-list-bounces+bedouglas=earthlink.net at python.org]On Behalf
Of tac-tics
Sent: Tuesday, July 04, 2006 9:53 PM
To: python-list at python.org
Subject: Re: defining multi dimensional array



bruce wrote:
> hi...
>
> basic question..
>
> how do i define a multi dimensional array
>
>  a[10][10]

I find that list comprehensions are useful for this.

[ [None for x in xrange(10)] for y in xrange(10)]

You could easily write a wrapper for it to clean the syntax a bit.

--
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list