user-defined type example

Matt Knox mattknox_ca at hotmail.com
Sat Oct 7 15:11:56 CDT 2006


Could someone please point me to/provide me with a basic example of creating a user defined type?
 
Here is my completely naive attempt which obviously doesn't work...import numpy
 
class myType(numpy.void):    def __init__(self,val):        self.val = val
 
testType = numpy.dtype(myType)
val1 = myType(5)val2 = myType(6)
 
foo = numpy.array([val1,val2],testType)
 
 
Any help would be greatly appreciated. Thanks,
 
- Matt Knox
 
 
_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061007/3a0c9e07/attachment.html 
-------------- next part --------------
-------------------------------------------------------------------------
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
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list