• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
pyobjc, **out parameters, and informal protocols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: +[NSColor highlightColor] in NSTableView
  • Next by Date: Re: Questions regarding programming custom visual components
  • Previous by thread: Re: GUI threading question
  • Next by thread: Stack trace without atos
  • Index(es):
    • Date
    • Thread