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@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to