Re: [Pyobjc-dev] Passing an numeric array to objectiveC
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2006-02-05 06:51:38
|
On Feb 4, 2006, at 10:40 PM, Ronald Oussoren wrote: > > On 5-feb-2006, at 3:13, Brian O'Brien wrote: > >> >> On 4-Feb-06, at 6:06 PM, Bob Ippolito wrote: >> >>> On Feb 4, 2006, at 4:59 PM, Brian O'Brien wrote: >>> >>>> If, from python I pass a numeric array to an objectiveC method/ >>>> selector, how do I access the data in the numeric array? >>> >>> I'm guessing it'll come over as NSData... so you'd use the bytes >>> message to get at the pointers to the raw array. >> >> Tell me... Does the numeric array know is dimensions, if >> so do you think they are passed on to the NSData type? > > We don't have specific support for numeric arrays. It will either > be passed as an NSData or a generic python object. In either case > you'll have to the the Python C API to access most features of > numeric arrays. > > BTW. I suppose you're using Numeric, numpy, numarray or scipy core > (or whatever the prefered array implementation is these days...) It would probably make sense to add generic valueForKey: support to the proxy subclasses so that you can get at most of the information that would be useful from a Numeric array. "shape" is a tuple attribute and typecode, itemsize are no-argument functions... so that would probably work fine. -bob |