[Numpy-discussion] restricting object arrays to a single Python type

Geoffrey Irving irving at naml.us
Tue Jul 16 20:15:22 EDT 2013


On Tue, Jul 16, 2013 at 4:51 PM, Anthony Scopatz <scopatz at gmail.com> wrote:
> Hi Geoffrey,
>
> Not to toot my own horn here too much, but you really should have a look at
> xdress (http://xdress.org/ and https://github.com/xdress/xdress).  XDress
> will generate a wrapper of the Force class for you and then also create a
> custom numpy dtype for this class.  In this way, you could get exactly what
> you want.

Unfortunately it's unlikely to work out of the box, since it uses
gccxml which appears to still be based on gcc 4.2.  All of our code is
C++11, and we need to preserve portability to horrible places like
Visual Studio (yes, these two constraints are just barely compatible
at the moment).

> If you run into any trouble, let me know and I'll be sure to help you out!
> This is the kind of thing that xdress is supposed to do so bugs here are a
> big priority for me personally =)

We're currently using a custom Python binding layer which I wrote a
while ago after getting fed up with boost::python.  Our system is
extremely lightweight but also limited, and in particular is missing a
few key features like automatic support for named and default
arguments (since these can't be introspected inside C++).  It'd be
great to chat more about our two feature sets and whether there are
opportunities for collaboration and/or merging.  I'm not sure if this
list is a good place for that discussion, so we could optionally take
it off list or to skype if you're up for that (send me an email
directly if so).

Here are links to our system, which unfortunately is undocumented at the moment:

    https://github.com/otherlab/core
    https://github.com/otherlab/core/blob/master/python/ClassTest.cpp
# Unit test for wrapping a class

Geoffrey



More information about the NumPy-Discussion mailing list