[SciPy-user] 'object_arrtype' problem

Ryan Krauss ryanlists at gmail.com
Thu Dec 8 11:23:25 CST 2005


What do you mean by "hand off behavior of the object to the underlying
object in all cases"?

Ryan

On 12/8/05, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> Ryan Krauss wrote:
>
> >I am having a problem very similar to one Chris Fonnesbeck was having
> >a few days ago.  I have a list of user defined objects.  I also want
> >to allow for the passing of a scalar to this particular function, so I
> >call atleast_1d on the list/scalar and then iterate over it.  After I
> >call atleast_1d, indexing the list returns object_arrtype.  One
> >interesting thing is that I have redefined __repr__ for this object,
> >and that method seems to be called correctly, but trying to access any
> >other property of the object causes messages like "*** AttributeError:
> >'object_arrtype' object has no attribute 'dof'".  Here is a pdb
> >session just before and after atleast_1d is called.  Is this a bug or
> >should I be doing this differently with new scipy (this code worked
> >fine with old scipy).
> >
> >
> I think the object scalars need a little more work.    There is a valid
> question whether to have them at all.
> What these scalars do is unify the methods of scalars and arrays.
> Without them, then object arrays would have different selection
> semantics then non-object arrays.  Perhaps this would be a "good" thing.
>
> At any rate, you can always get the underlying object the object-scalar
> wraps using the toscalar() method.
>
> I think a very natural thing-to-do, though, which would clear up these
> issues and leave the object scalar  around is to hand off behavior of
> the object to the underlying object in all cases.
>
> -Travis
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>



More information about the SciPy-user mailing list