[Pythonmac-SIG] Getting None in KVC objectInKeyAtIndex_
Ronald Oussoren
ronaldoussoren at mac.com
Tue Apr 14 09:44:29 CEST 2009
A better way to define such accessors is like so:
@objc.accessor
def objectInFooAtIndex_(self, index):
pass
This should deduce the right method signature based on the method
name. I guess this needs better documentation :-(
Ronald
On 13 Apr, 2009, at 19:00, David Hain wrote:
> On Apr 13, 2009, at 2:10 AM, Johan Rydberg wrote:
>
>> http://jimmatthews.wordpress.com/2007/07/12/objcselector-and-objcsignature/
>
> Yes! That was exactly what I needed. I had actually thought that
> pyobjc could be interpreting a zero as nil, and did something like:
>
> if index is None:
> index = 0
>
> but then the program crashed with a Bus Error. I now assume that is
> because the bridge didn't know what to expect my method to return.
> With the signature line, I've told it to expect an object, so it
> works flawlessly!
>
> Thanks for the help!
> -David
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2224 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090414/69cde946/attachment.bin>
More information about the Pythonmac-SIG
mailing list