[PYTHON MATRIX-SIG] Creating grid object

David Ascher da@maigret.cog.brown.edu
Thu, 17 Oct 1996 15:37:21 -0400 (EDT)


> Thanks for your reply. I tried it that way, but the problem is, that I
> can't use normal functions on the new class, like
> shape(new_class_instance) 
> Here I must use at the moment
> shape(new_class_instance.array)
> or I must add this function to MyUserArray in the same way sin and cos
> are added. But I think this is not a generally good way.

Yes.  It's a point worth raising.  I too care about UserArray
subclasses, and I'd want functions which take arrays as argument to be
able to work with userarrays.

It shouldn't be too bad of a problem if UserArray is kept up to date --
as long as it has the same attributes as the arrays it wraps, then all
functions which work on arrays will work on it (correct?).

Given that I just said that, it doesn't really work right now.  I would
have guessed that shape(x) returns x.shape, but a little testing shows
that that is not true in 1.4b3.  Shouldn't it be?

--david


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================