On 16 Aug, 2010,at 09:18 AM, James R Eagan <james.eagan@...> wrote:
You may find the PyObjC tutorial useful. In particular, this section : http://pyobjc.sourceforge.net/documentation/pyobjc-core/intro.html#accessing-python-objects-from-objective-c
You can typically use a python unicode (or str if you absolutely positively know you'll never ever have any non ASCII, but you don't) wherever an NSString is expected.
Envoyé de mon mobile / Sent from my mobile
Le 14 août 2010 à 21:31, Andrew Pennebaker <andrew.pennebaker@...> a écrit :
> I know ObjC, and I know Python. What I do not know is:
> * How to convert between NSString and Python string.
Could you explain what you're trying to do? PyObjC will automaticly translate datatypes when calling methods.
> * How to convert (id) something into an NSString (and then to a Python string).
> * How to create an NSArray of NSStrings using NSArray.arrayWithObjects and Python strings.
anArray = [u"foo", u"bar"]
PyObjC will provide an NSArray subclass when that array is passed to Objective-C code.
When you need a real NSArray, for example because you use Key-Value Observation:
anArray = NSMutableArray.arrayWithArray_([u"foo", u"bar"])
> * Whether None is an acceptable substitute for ObjC's nil.
Yes, and that is documented in PyObjC documentation.
> None of these are found in the PyObjC docs. Instead, I just see which things aren't implemented yet. That's extremely unhelpful.
The documentation needs work, but all of this is documented in the pyobjc-core documentation (in particular in the introduction).
Get latest updates about Open Source Projects, Conferences and News.