[Numpy-discussion] Multiarray PEP
Paul Barrett
barrett at stsci.edu
Thu Feb 17 05:58:19 EST 2005
Travis Oliphant wrote:
>
> I am looking for feedback on the PEP. Of particular interest is the
> specification of multidimensional indexing that I've outlined. I think
> it is mostly the same as numarray (I'd love some feedback to be sure
> about that), except for the fact that X[K] where K is a a single integer
> index array can do 1-d indexing similar to MATLAB. The equivalent
> numarray indexing is available as X[K,]. Now that I've specified what
> is to happen, I think it won't be very difficult to code.
Your indexing implementation appears reasonable.
> I would also like some help on resolving the type issue. Is it
> important to have hierarchial classes defined (probably in Python) that
> can be used to check and/or specify type or are functions that check for
> various properties, fine. Right now x.type is specified as an
> attribute but the attribute could be replaced by a method. What to
> return is the biggest question.
I don't see the need for hierarchical type classes, though it might ease
the comparison with Python types.
> I've never had a problem with just the typecode characters although
> aliases (like Int16 or Short) which might be more meaningful are nice.
> Are shadow-classes important in this case? To me they look a little
> like extra bulk with no gain. I'd love to be educated as to why it is
> worth the extra effort to have a bunch of instances lying around. I
> don't feel very strongly about this though, so if somebody else does,
> I'm willing to go for it.
I prefer Int16, UInt16, Float32, Float64, etc. for specifying types.
They are unambiguous and the scheme is easily extendable. I also don't
mind character code aliases for named types as long as they are a
shorthand for the them and are not used routinely when doing a repr.
-- Paul
--
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
More information about the NumPy-Discussion
mailing list