[IronPython] jagged arrays

Curt Hagenlocher curt at hagenlocher.org
Wed May 27 16:52:11 CEST 2009


On Wed, May 27, 2009 at 7:30 AM, Elise Langham (Elanit)
<i-ellang at microsoft.com> wrote:
> How do i create a jagged array in IronPython ?
>
> I’ve tried various methods:
> jagArray = Array[Array[int]]( ( (1,2), (1,2), (1,2,3), (1,2,3,4) ))

I'd write a helper method:

def make_jagged(T, v):
    return Array[Array[T]]([Array[T](x) for x in v])

And then say "make_jagged(int, ((1, 2), (1, 2, 3), (1,)))"

--
Curt Hagenlocher
curt at hagenlocher.org



More information about the Ironpython-users mailing list