[Pythonmac-SIG] noob question: handling protocols and files

Ronald Oussoren ronaldoussoren at mac.com
Mon Aug 8 12:40:46 CEST 2005


 
On Monday, August 08, 2005, at 00:30AM, Bob Ippolito <bob at redivi.com> wrote:

>>
>> I was confused by @selector(handleGetURLEvent:withReplyEvent:) and the
>> error message I got when I tried my first intuition. My first attempt
>> was to just pass my Python method, but that complained saying that SEL
>> was expected instead of an instance method.
>
>That should've worked.

If it didn't work you're class is probably not a subclass from NSObject, I'd advise against doing that. It is possible to access methods in pure-python classes from Objective-C, but that code is not as well tested as accessing methods in subclasses from NSObject.


>
>> I really don't think I would have guessed to pass a string with the
>> selector name. That and the use of GURL instead of gurl was all it
>> took to get my program called at the right time.
>
>Selectors themselves are just interned char*

That depends on your point of view :-). The C type 'SEL' and the result of @selector is indeed an interned char*, I'd say a selector is the same as an instance method.

>
>-bob
>
>
>
>


More information about the Pythonmac-SIG mailing list