Re: [Pyobjc-dev] Bridging of Strings
Brought to you by:
ronaldoussoren
From: David E. <epp...@ic...> - 2002-12-30 00:15:25
|
On 12/23/02 8:30 PM +0100 Ronald Oussoren <ous...@ci...> wrote: >> ValueError: NSInvalidArgumentException - *** -count only defined for >> abstract class. Define -[NSCFArray count]! >> > > That's just like in 'normal' python types: If you call NSArray.count you > get the count method defined by NSArray instead of the one defined by > the class of your object. That is not very Objective-C-like, but this is > needed to implement super(cls, self).count(). A possibly related recent surprise I had: I had an NSArray object X (or its Python proxy) and attempted to retrieve X[-1]. Got an NSRangeError rather than the expected last array item. Trivial to work around, but shouldn't this work? > That's not really a problem, just use the strint literal > "localizedCaseInsentiveCompare:" as the argument off > NSArray.sortedArrayUsingSelector_. By the time strings NSArray methods > touch the strings in an array they will be converted to NSString (that's > even true if the NSArray is the OC_PythonArray proxy for a python > sequence). Well, except that what I really want to sort isn't an NSArray of strings, it's a Python list of Python dictionaries, which I want to sort according to the (localized case-independent) string values stored under one of the keys in each dictionary. -- David Eppstein UC Irvine Dept. of Information & Computer Science epp...@ic... http://www.ics.uci.edu/~eppstein/ |