How to write an API for a Python application?

Mike Meyer mwm at mired.org
Thu Nov 17 13:33:00 EST 2005


"Eric Brunel" <eric_brunel at despammed.com> writes:
> On Wed, 16 Nov 2005 15:43:33 -0500, Mike Meyer <mwm at mired.org> wrote:
>
>> "Eric Brunel" <eric_brunel at despammed.com> writes:
>>> On 16 Nov 2005 06:18:05 -0800, Paul Boddie <paul at boddie.org.uk> wrote:
>>>> One technology that I used many years ago with Python, and which should
>>>> still do the job is CORBA - at that time ILU, but I suppose the various
>>>> other ORBs should also be as capable; certainly, ILU permitted
>>>> callbacks from the server into the client. These days, you might want
>>>> to look at omniORB, Fnorb and ORBit.
>>> I never saw any way to create callbacks from server to client with CORBA. How would you describe such a callback in the IDL file?
>> It's OO, not functional. You pass an object to the server, and the
>> server invokes methods on that object. In the IDL, you use the
>> interface name as a type. I.e.:
>>
>>   interface Window {
>>   ...
>>   }
>>  and in another interface:
>>   WindowList	FindWindows(in Window name) ;
>
> This is slowly drifting OT, but aren't the interfaces in the IDL implemented on the server, and not on the client? So passing an "interface instance" to a method will just make the server call itself, won't it? Or you have to turn your client into a server, which makes things a lot more complicated.

Yes, your client turns into a server. That's pretty much required for
callbacks to work, no matter what technology you use. While the
details are a lot more complicated than being a simple client, you get
to ignore a lot of them - like how clients find you - and a lot of the
rest are taken care of by the ORB, which you have to have to be a
CORBA client.

What you pass isn't an "interface instance", it's a locator for an
object that implements the interface. So you can pass an instance on
the server if you really want to, but you can also pass one for the
client.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list