[Numpy-discussion] Array interface

Magnus Lie Hetland magnus at hetland.org
Tue Apr 5 01:57:12 CDT 2005


Scott Gilbert <xscottg at yahoo.com>:
>
[snip]
> I think the intent is that libraries like wxPython or PIL can
> recognize data that they *want* to work with.  They can raise an
> exception when passed anything that is more complicated than they're
> willing to deal with.

Sure. I'm just saying that it would be good to have a baseline -- a
basic, mandatory level of conformance, so that if I expose an array
using only that part of the API (or, with the rest being optional
information) I know that any conforming array consumer will understand
me.

As long as we have this, I have to know the capabilities of my
consumer before I can write an appropriate typestr, for example. E.g.,
one application may only accept b1, while another would only accept i1
etc. Who knows -- there may well be sets of consumer applications that
have mutually exclusive sets of accepted typestrings unless a minimum
is mandated.

That's really what I was after here. In addition to saying that
typestr *must* be supported, one might say something about what
typestrs must be supported.

On the other hand -- perhaps such requirements should only be made on
the array side? What requirements can/should one really make on the
consumer side? I mean -- even though we have a strict sequence
protocol, there is nothing wrong with creating something sequence-like
(e.g., supporting floats as indices) and having consumer functions
that aren't as strict as the official protocol...

I just think it's something that it might be worth being explicit
about.

-- 
Magnus Lie Hetland                    Fall seven times, stand up eight
http://hetland.org                                  [Japanese proverb]




More information about the Numpy-discussion mailing list