This could actually be done by using the structured dtype pretty easily. The hard work would be improving the ufunc and generalized ufunc mechanism to handle structured data-types. Numba actually provides some of this already, so if you have NumPy + Numba you can do this sort of thing now.
-Travis On Wed, Sep 24, 2014 at 12:08 PM, Chris Barker <chris.bar...@noaa.gov> wrote: > On Tue, Sep 23, 2014 at 4:40 AM, Eric Moore <e...@redtetrahedron.org> > wrote: > >> Improving the dtype system requires working on c code. >> > > yes -- it sure does. But I think that is a bit of a Red Herring. I'm > barely competent in C, and don't like it much, but the real barrier to > entry for me is not that it's in C, but that it's really complex and hard > to hack on, as it wasn't designed to support custom dtypes, etc. from the > start. There is a lot of ugly code in there that has been hacked in to > support various functionality over time. If there was a clean > dtype-extension system in C, then A) it wouldn't be bad C to write, and B) > would be pretty easy to make a Cython-wrapped version. > > Travis gave a nice vision for the future, but in the meantime, I'm > wondering: > > Could we hack in a generic "custom dtype" dtype object into the current > system that would delegate everything to the dtype object -- in a truly > object-oriented way. I'm imagining that this custom dtype object would be a > pyObject and thus very hackable, easy to make a new subclass, etc -- > essentially like making a new class in python that emulates one of the > built-in type interfaces. > > This would be slow as a dog -- if inside that C loop, numpy would have to > call out to python to do anyting, maybe as simple as arithmetic, but it > would be clean, extensible system, and a good way for folks to plug in and > try out new dtypes when performance didn't matter, or as prototypes for > something that would get plugged in at the C level later once the API was > worked out. > > Is this even possible without too much hacking to the current dtype > system? Would it be as simple as adding a bit to the object dtype? > > -Chris > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > chris.bar...@noaa.gov > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- Travis Oliphant CEO Continuum Analytics, Inc. http://www.continuum.io
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion