Numeric - writing extentions

eric jones eric at
Thu Jan 17 12:34:47 EST 2002

Hey Jesper,

> My extention module is a speech recogniser - so I think
> it would be a bit ritch to inline it all :-)

weave.inline is actually pretty flexible and might be up to the task.  If it
doesn't look like it is the right tool, you might look at the
weave.ext_tools module.  It takes much of the hard work out of building
stand-alone extension modules and will handle Numeric array conversions
automatically.  If your code library already exists, tools like SWIG are
also good options.

Unless your interested in doing this as a learning process, I think a
wrapper generator is gonna be faster and less error prone than hand coding
the extensions.

> But the weave exampel looks interesting - I might want to use it
> if it is stabel.

It's to early (0.2) to call it stable, but it passes a reasonably large test
suite across 4  different platforms, and we're working to get around
compiler bugs on another one (almost there).  I consider it usable for real
work now on the supported platforms.

SWIG has been around along time and can be considered stable.


> BTW - as was suggested in other replies to my posting,
> the Numeric extention example I posted needs an "import_array()" statement
> in the init function. Then it works.
> Cheers
> Jesper
> Fernando Pérez <fperez528 at> wrote in message
news:<a24fvk$f79$1 at>...
> > Jesper Olsen wrote:
> >
> > > Today I downloaded and installed Numeric-20.3 from sourceforge
> > > - I installed it from source, and it seems to work ok (with python
> > >
> > > Now I want to write an extention where I use Numeric.array
> > >
> >
> > You may want to take a serious look at weave
> > ( It may be the case that you
> > need a full blown extension, but chances are some inlined C with weave,
> > either using blitz() or inline() with blitz type factories may do. And
> > *vastly* simpler to use.
> >

More information about the Python-list mailing list