[zeromq-dev] Design question: python interface for zmq_poll
Brian Granger
ellisonbg at gmail.com
Tue Feb 16 22:15:10 CET 2010
Martin,
>> This handles both 0MQ sockets as well as any Python object that has a
>> fileno()
>> function (sockets, files, etc.)
>
> Nice! AFAIK this is the first binding (aside of C and C++) that's able to
> combine polling for BSD and 0MQ sockets.
Cool, wasn't too difficult once I understood what zmq_poll is doing
and returning.
>> This would give Python devs the same exact interfaces they have with
>> regular sockets. What do
>> people think about this? My only hesitancy is that this is a
>> departure from the 0MQ zmq_poll
>> interface, so 0MQ devs coming from C/Java, etc will find the interface
>> quite different.
>> I could also provide all 3 interfaces and give the dev a choice.
>
> I am not a Python developer so my vote doesn't count, however, I would
> refrain from providing multiple APIs for the same functionality. That's just
> asking for maintenance trouble. Also, I wouldn't be afraid of departing from
> undelying C API if there's a widely accepted API for this kind of thing in
> Python. The goal is to make life easier for Python developers rather than
> copying C API verbatim.
I am not too worried about the maintenance of this. With the core logic
already in place, the different interfaces will only be a few lines of
pure Python code.
But, if we have to pick 1 interface, I would probably use the built-in
poll interface in select.poll.
I will wait a bit to see if others have opinions on this.
Cheers,
Brian
> Martin
>
--
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com
More information about the zeromq-dev
mailing list