On 3/2/07, John Hunter <[EMAIL PROTECTED]> wrote:
John said:
...here is the minimal interface that
appears to work
class C(object):
def __init__(self):
self._data = (1,2,3,4,5)
def __getitem__(self, i):
return self._data[i]
def __len__(self):
return len(self._data)
import numpy
c = C()
print numpy.asarray(c)
To all,
Thanks for the help. I had the other member functions implemented and I
simply needed to add the __getitem__ member function.
BTW: I am actually using Boost.Python to expose my C++ library to Python. I
was able to add the __getitem__ member function to my class and
voila...things worked nicely (I already had the __len__ member function).
-------------------------------------------------------------------------
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