Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 10:03 PM, AggieDan04 wrote: > On Sep 23, 3:02 pm, Simon Forman wrote: >> On Wed, Sep 23, 2009 at 1:14 PM, Rudolf wrote: >> > Can someone tell me how to allocate single and multidimensional arrays >> > in python. I looked online and it

Re: arrays in python

2009-09-23 Thread AggieDan04
On Sep 23, 3:02 pm, Simon Forman wrote: > On Wed, Sep 23, 2009 at 1:14 PM, Rudolf wrote: > > Can someone tell me how to allocate single and multidimensional arrays > > in python. I looked online and it says to do the following x = > > ['1','2','3&#

Re: arrays in python

2009-09-23 Thread Donn
On Wednesday 23 September 2009 22:12:24 Ethan Furman wrote: > Works great if you want 4,999,999 elements. ;-) Omit the '1' if you > want all five million. Yes. Fenceposts always get me :) And I was just reminded that one can: l=range(500) \d -- home: http://otherwise.relics.co.za/ 2D vector

Re: arrays in python

2009-09-23 Thread Ethan Furman
Donn wrote: On Wednesday 23 September 2009 19:14:20 Rudolf wrote: I want to allocate an array and then populate it using a for loop. You don't need to allocate anything, just use the list or dictionary types. l=[] #empty list for x in range(1,500): l.append(x) \d Works great if you

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:22 PM, Donn wrote: > On Wednesday 23 September 2009 19:14:20 Rudolf wrote: >> I want to allocate an array and then populate it >> using a for loop. > You don't need to allocate anything, just use the list or dictionary types. > > l=[] #empty list > for x in range(1,50

Re: arrays in python

2009-09-23 Thread Simon Forman
On Wed, Sep 23, 2009 at 1:14 PM, Rudolf wrote: > Can someone tell me how to allocate single and multidimensional arrays > in python. I looked online and it says to do the following x = > ['1','2','3','4'] > > However, I want a much larger arr

Re: arrays in python

2009-09-23 Thread Michel Claveau - MVP
Hi! See: http://docs.python.org/tutorial (section 5) @+ -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: arrays in python

2009-09-23 Thread Benjamin Kaplan
On Sep 23, 2009, at 1:16 PM, Rudolf wrote: > Can someone tell me how to allocate single and multidimensional arrays > in python. I looked online and it says to do the following x = > ['1','2','3','4'] > > However, I want a much larger arr

Re: arrays in python

2009-09-23 Thread Donn
On Wednesday 23 September 2009 19:14:20 Rudolf wrote: > I want to allocate an array and then populate it > using a for loop. You don't need to allocate anything, just use the list or dictionary types. l=[] #empty list for x in range(1,500): l.append(x) \d -- http://mail.python.org/mailman/

arrays in python

2009-09-23 Thread Rudolf
Can someone tell me how to allocate single and multidimensional arrays in python. I looked online and it says to do the following x = ['1','2','3','4'] However, I want a much larger array like a 100 elements, so I cant possibly do that. I want to allocate a

Re: Using arrays in Python - problems.

2007-10-23 Thread attackwarningred
Thanks very much to those who sent me a reply to my array problem! Its now working brilliantly! Best wishes, Gareth. -- [EMAIL PROTECTED] [EMAIL PROTECTED] 665.9238429876 - Number of the Pentium Beast -- http://mail.python.org/mailman/listinfo/python-list

Re: Using arrays in Python - problems.

2007-10-23 Thread Duncan Smith
[EMAIL PROTECTED] wrote: > attackwarningred napisa (a): > > >>The array F(n) is dynamically allocated earlier on and is sized with >>reference to shotcount, the number of iterations the model performs. The >>problem is I can't get something like this to run in Python using numpy, >>and for the si

Re: Using arrays in Python - problems.

2007-10-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > attackwarningred napisa (a): > >> The array F(n) is dynamically allocated earlier on and is sized with >> reference to shotcount, the number of iterations the model performs. The >> problem is I can't get something like this to run in Python using numpy, >> and for the s

Re: Using arrays in Python - problems.

2007-10-23 Thread marek . rocki
attackwarningred napisa (a): > The array F(n) is dynamically allocated earlier on and is sized with > reference to shotcount, the number of iterations the model performs. The > problem is I can't get something like this to run in Python using numpy, > and for the size of the array to be sized dyn

Using arrays in Python - problems.

2007-10-23 Thread attackwarningred
Dear All, Hello! I've just started to use Python and its a lovely language! I've previously programmed in Fortran 95 and have just began to use numpy. I'm having a few problems with arrays in Python though and wondered if someone could offer me some advice? I wrot

Re: arrays in python

2006-02-10 Thread plahey
> Oh, don't tell me, I love playing guessing games! Don't you mean "No no... don't tell me. I'm keen to guess." Sorry, I couldn't resist... :-) (for those who just went huh?, see http://www.aldo.com/sgt/CheeseShoppeSkit.htm) -- http://mail.python.org/mailman/listinfo/python-list

Re: arrays in python

2006-02-10 Thread Steven D'Aprano
On Fri, 10 Feb 2006 17:50:21 -0500, Kermit Rose wrote: > I want to write a program in python using integer arrays. > > I wish to calculate formulas using 200 digit integers. Must the integers have exactly 200 digits? If you multiply one of these 200-digit integers by ten, should it silently ove

Re: arrays in python

2006-02-10 Thread Schüle Daniel
> I want to write a program in python using integer arrays. you can :) > I wish to calculate formulas using 200 digit integers. no problem > I could not find any documentation in python manual about declaring arrays. > > I searched the internet read here http://diveintopython.org/native_dat

Re: arrays in python

2006-02-10 Thread Steve Holden
Kermit Rose wrote: > From: Kermit Rose > Date: 02/10/06 17:36:34 > To: [EMAIL PROTECTED] > Subject: Arrays > > > Hello. > > I want to write a program in python using integer arrays. > > I wish to calculate formulas using 200 digit integers. > > I could not find any documentation in pytho

arrays in python

2006-02-10 Thread Kermit Rose
From: Kermit Rose Date: 02/10/06 17:36:34 To: [EMAIL PROTECTED] Subject: Arrays Hello. I want to write a program in python using integer arrays. I wish to calculate formulas using 200 digit integers. I could not find any documentation in python manual about declaring arrays. I searched

Re: Long integer arrays in Python; how? /Carl

2005-11-28 Thread Robert Kern
Carl wrote: > I have the following problem > > import Numeric > dim = 1 > bits = 32 > v = Numeric.zeros((dim, bits), 'l') > for j in range(bits): > v[0][j] = 1L << bits - j - 1 > > The problem is the last assignment, which is not valid, since the integer is > on the r

Long integer arrays in Python; how? /Carl

2005-11-28 Thread Carl
I have the following problem import Numeric dim = 1 bits = 32 v = Numeric.zeros((dim, bits), 'l') for j in range(bits): v[0][j] = 1L << bits - j - 1 The problem is the last assignment, which is not valid, since the integer is on the right hand side is to large to be a