On Friday 02 March 2007 14:12:24 John Hunter wrote:

> I still am not able to make my mock-up custom python class work as I
> would like with asarray (though it works with "list").  What am I
> missing?  The way I read it this appears to be in support of extension
> code that wants to expose the array interface, but I have a python
> object that acts like a sequence (am I missing some important method)
> that wants to work properly with numpy.asarray

John,
Why wouldn't you use the numpy.core.ma implementation of masked arrays as a 
source of inspiration ? After all, what (I think) you're doing is pretty 
close to how masked arrays were initially implemented, as a class on its own, 
not derived from ndarray.
Basically, that would amount to define a __array__() method that would return 
the numpy equivalent of your object.

Or you can try to use Pyrex for your new class. That works well if you don't 
try to subclass ndarray.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to