From: Travis O. <oli...@ie...> - 2006-10-08 04:28:41
|
Matt Knox wrote: > 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, > A "true" user-defined data-type can only be done in C. However. You can use the "VOID" data-type to create a type with multiple fields. What do you want to do with your user-defined data-type. -Travis |