Scripts used during building and/or development of PyObjC.
- Scripts that are useful
l for users of PyObjC
+ Scripts that are useful for users of PyObjC
to keep a reference. This includes all factory methods (e.g.
-The objc module tries to make the management of reference counts completely
-transparent for the user of the module. This is mostly solved in
-[de]pythonify_c_value. Additonal code is needed when calling methods that
-transfer ownership of their return value (as described above) and when updating
-a instance variable in an Objective-C object (retain new and release old,
-in that order). Both are implemented.
+When programming Cocoa in Python, you almost never need to worry about
+reference counts: the objc module makes this completely transparent to user.
+This is mostly implemented in [de]pythonify_c_value. Additonal code is needed
+when calling methods that transfer ownership of their return value (as
+described above) and when updating a instance variable in an Objective-C
+object (retain new and release old, in that order). Both are implemented.
-We currently automaticly convert from Python strings to NSStrings (and back).
-This may not be the smartest thing to do because NSString has a number of
-methods that don't have an equivalent in Python.
+We currently automatically convert from Python strings to NSStrings (and
+back). An NSString is represented in Python as a subclass of the 'unicode'
+class: objc.pyobjc_unicode. This is a conversion as well as a *reference* to
+the original NSString. The NSString is accessible in Python with the
+.nsstring() method, to allow access to NSString's methods (NSMutableString's
-Converting a Python string to objective-C and back currently converts the
-string to Unicode. If may be usefull to try to convert to a normal string
+Converting a Python string to Objective-C and back currently converts the
+string to Unicode. If may be useful to try to convert to a normal string
(using [NSString dataUsingEncoding:allowLossyConversion:]) and only return
a Unicode object if that fails.
When translating from NSString to a Python unicode object (and back) we first
translate to a UTF8 encoding. This way we don't have to worry about any
-differences in the representation of Unicode strings in Python and objective-C
-(Python has two different represenations, selection is at compile-time)
+differences in the representation of Unicode strings in Python and Objective-C
+(Python has two different represenations, selection is at compile-time).