Hi,

Say, one defines

class A(tuple):
  def __repr__(self):
    return 'A(%s)' % (tuple.__repr__(self))

and I'd like to create an array of A instances.

Currently I get

>>> array([A((1,2))], dtype=object)
array([[1, 2]], dtype=object)

but what I'd like to get is

array([A((1, 2))], dtype=object)

I tried defining A.__array__ method but that does not have
effect when A instance is inside a sequence to array call.

Thanks for any information for how to resolve this problem,
PEaru

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to