[IronPython] Arrays in IronPython
dinov at exchange.microsoft.com
Fri Sep 22 12:58:00 PDT 2006
You can initialize the values on this like:
Array[Array[int]]( ( (1,2), (2,3) ) )
(any sequence will do here, e.g. a list work too).
If you want to create a true multi-dimensional array you can do:
x = Array.CreateInstance(int, Array[int]( (1,2,3)))
And then you can fill the values by hand:
x[0,1,2] = 2
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of David Anton
Sent: Wednesday, September 20, 2006 8:15 AM
To: users at lists.ironpython.com
Subject: [IronPython] Arrays in IronPython
After a lot of googling on this, I'm still confused about .NET arrays (not Python lists) in IronPython.
One dimensional arrays are clear:
foo = Array[int] ((1,2))
But how to set up jagged arrays and multidimensional arrays?
I know that IronPython is happy with the following (i.e., no error), but I'm not sure what they mean:
foo = Array[int][int]
foo = Array[Array[int]]
The first one behaves just like Array[int], so I think IronPython is just ignoring the second "[int]" ?
The second one would appear to me to be a jagged array, but how do I initialize it with values?
View this message in context: http://www.nabble.com/Arrays-in-IronPython-tf2306048.html#a6409948
Sent from the IronPython mailing list archive at Nabble.com.
users mailing list
users at lists.ironpython.com
More information about the users