On Mar 2, 2006, at 1:57 PM, Brian O'Brien wrote:
> I have an ObjectiveC framework that is expecting an array of
> floating point numbers.
> In pyhon how do I setup an array of floating point numbers and pass
> them to the ObjectiveC framework?
The easiest way would be to write a method in Objective-C that
expects a NSData that is a pointer to an array of floating point
[self doStuffWithFloatingPoint:(float*)[floats bytes] count:([floats
Once you have that, you can create the array with the array module
(or Numeric or numarray or numpy..).
floatarray = array.array('f', [1,2,3,4,5,6])
That should Just Work.
You could write -doStuffWithFloatingPoint: as a category in PyObjC..
but that's not the kind of code I can write off the top of my head in
Mail because it's been a while :)