Re: defining multi dimensional array

2006-07-05 Thread Fredrik Lundh
bruce wrote: > basic question.. which means that it can usually be answered by reading the tutorial, the FAQ, or by googling for "python" plus your subject line... > how do i define a multi dimensional array > > a[10][10] > > is there a kind of a = array(10,10) http://pyfaq.infogami.com/how

Re: defining multi dimensional array

2006-07-05 Thread Nick Craig-Wood
bruce <[EMAIL PROTECTED]> wrote: > i need a multi dimensional array of lists... > > ie >[q,a,d] >[q1,a1,d1] >[q2,a2,d2] >[q3,a3,d3] > > which would be a (3,4) array... Multi-dimensional arrays aren't a built in feature of python. You can simulate them two ways 1) with a li

RE: defining multi dimensional array

2006-07-04 Thread Steven D'Aprano
On Tue, 04 Jul 2006 22:07:59 -0700, bruce wrote: > do i need to import anything for this.. or is it supposed to work out of the > box.. Why don't you try it, and see if it gives you a result or raises an exception? The exception (if any) will give you a clue what you need to do. > and just what

RE: defining multi dimensional array

2006-07-04 Thread bruce
: 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 wrappe

Re: defining multi dimensional array

2006-07-04 Thread tac-tics
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.pytho

RE: defining multi dimensional array

2006-07-04 Thread bruce
i tried to do a1[10][10] = ['a','q'] and get an error saying a1 is not defined -bruce -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Erik Max Francis Sent: Tuesday, July 04, 2006 9:14 PM To: python-list@python.org Subject

Re: defining multi dimensional array

2006-07-04 Thread Erik Max Francis
bruce wrote: > basic question.. > > how do i define a multi dimensional array > > a[10][10] > > is there a kind of a = array(10,10) It's just a list of lists. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfranci

RE: defining multi dimensional array

2006-07-04 Thread bruce
@python.org Subject: defining multi dimensional array hi... basic question.. how do i define a multi dimensional array a[10][10] is there a kind of a = array(10,10) thanks -bruce -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

defining multi dimensional array

2006-07-04 Thread bruce
hi... basic question.. how do i define a multi dimensional array a[10][10] is there a kind of a = array(10,10) thanks -bruce -- http://mail.python.org/mailman/listinfo/python-list