[Numpy-discussion] Multiarray PEP
verveer at embl-heidelberg.de
Thu Feb 17 01:27:17 EST 2005
> 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'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've designed Numeric3 so that it is not difficult to change how
> typecodes are specified on the Python level. We can really
> accommodate whatever.
I am used to the numarray convention of using Int16 and so on, which to
me are more meaningful and far more easy to remember then typecode
characters. These could be aliases for character codes, which for most
purposes would be fine for me. The only practical problem that comes to
mind now is that if you print a type, you would get its character code,
which I would find inconvenient as I generally don't use them. By using
a python class you can use any string representation you like. But I
suppose you could just provide a function/method to return a string
representation for an alias to solve that.
More information about the NumPy-Discussion