multidimensional array of objects in scipy core

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stormslayer

    #1

    multidimensional array of objects in scipy core

    Folks: How do you create a multidimesional array of objects w/ the size
    of the array entered at runtime? So basically, for an arbitrary class,
    create an array and then *.resize it to be of size NXM, and then
    populate the elements of the objects.

    thanks for any help.
    Scott

  • Robert Kern

    #2
    Re: multidimensiona l array of objects in scipy core

    Stormslayer wrote:[color=blue]
    > Folks: How do you create a multidimesional array of objects w/ the size
    > of the array entered at runtime? So basically, for an arbitrary class,
    > create an array and then *.resize it to be of size NXM, and then
    > populate the elements of the objects.[/color]

    First, asking on the scipy mailing list will get you a better response.

    Second, scipy_core does allow arrays of arbitrary Python objects, but
    it doesn't do any kind of type-checking for those arrays. It is up to
    you to populate the array with the kind of objects that you want.

    arr = empty((N, M), object)
    arr[i, j] = MyClass(i, j)

    should work (can't check at the moment, though).

    Please note that object arrays have always been tricky since Numeric,
    so if you encounter strange behaviour, we would appreciate a report on
    the scipy mailing list.

    Comment

    Working...