pyobjc, **out parameters, and informal protocols
pyobjc, **out parameters, and informal protocols
- Subject: pyobjc, **out parameters, and informal protocols
- From: Mani Ghasemlou <email@hidden>
- Date: Mon, 2 Feb 2009 11:37:35 -0500
Hi all,
>From what I understand of the Python-Objective-C documentation, "out"
pointer variables (such as "NSError **outError") are actually appended
to the list of return values for a bridge function.
For example:
int returnIntWithError: NSError **outError
from Python would be invoked as:
returned_int, returned_error = returnIntWithError_(None)
I hope that my understanding of the above is correct.
Now, my real question is to extend the above concept to the Python
side, when we want to implement an informal protocol. Let's say the
protocol says that I have to implement the returnIntWithError:
function as described above. How do I implement this function? Is the
code below enough?
def returnIntWithError_(self, outError):
myError = NSError.errorWithDomain_code_userInfo_('myDomain', '1', objc.nil)
myReturnVal = 1
return myReturnVal, myError
Note that I am completely ignoring the "outError" parameter. Does this
look kosher?
Thanks in advance for any help!
Cheers,
Mani
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden