[SciPy-dev] Re: [Numpy-discussion] Notes from meeting with Guido regarding inclusion of array package in Python core
Perry Greenfield
perry at stsci.edu
Thu Mar 10 15:21:16 EST 2005
On Mar 10, 2005, at 6:19 PM, Chris Barker wrote:
>
>> a) So long as the extension package has access to the necessary array
>> include files, it can build the extension to use the arrays as a
>> format without actually having the array package installed.
> > The
>> extension would, when requested to use arrays would see if it could
>> import the array package, if not, then all use of arrays would result
>> in exceptions.
>
> I'm not sure this is even necessary. In fact, in the above example,
> what would most likely happen is that the **Helper functions would
> check to see if the input object was an array, and then fork the code
> if it were. An array couldn't be passed in unless the package were
> there, so there would be no need for checking imports or raising
> exceptions.
>
So what would the helper function do if the argument was an array? You
mean use the sequence protocol? Yes, I suppose that is always a
fallback (but presumes that the original code to deal with such things
is present; figuring out that a sequence satisfies array constraints
can be a bit involved, especially at the C level)
>> It could be built, and then later the array package could be
>> installed and no rebuilding would be necessary.
>
> That is a great feature.
>
> I'm concerned about the inclusion of all the headers in either the
> core or with the package, as that would lock you to a different
> upgrade cycle than the main numerix upgrade cycle. It's my experience
> that Numeric has not been binary compatible across versions.
Hmmm, I thought it had been. It does make it much harder to change the
api and structure layouts once in, but I thought that had been pretty
stable.
>> b) One could modify the extension build process to see if the package
>> is installed and the include files are available, if so, it is built
>> with the support, otherwise not.The disadvantage is that later adding
>> the array package
>> require the extension to be rebuilt
>
> This is a very big deal as most users on Windows and OS-X (and maybe
> even Linux) don't build packages themselves.
>
> A while back this was discussed on this very list, and it seemed like
> there was some idea about including not the whole numerix header
> package, but just the code for PyArray_Check or an equivalent. This
> would allow code to check if an input object was an array, and do
> something special if it was. That array-specific code would only get
> run if an array was passed in, so you'd know numerix was installed at
> run time. This would require Numerix to be installed at build time,
> but it would be optional at run time. I like this, because anyone
> capable of building wxPython (it can be tricky) is capable of
> installing Numeric, but folks that are using binaries don't need to
> know anything about it.
>
> This would only really work for extensions that use arrays, but don't
> create them. We'd still have the version mismatch problem too.
>
Yes, at the binary level.
Perry
More information about the SciPy-Dev
mailing list