[zeromq-dev] Design question: python interface for zmq_poll
Brian Granger
ellisonbg at gmail.com
Tue Feb 16 21:24:25 CET 2010
Hi,
My Python bindings have support for zmq_poll now:
http://github.com/ellisonbg/pyzmq/blob/master/zmq/_zmq.pyx#L436
This handles both 0MQ sockets as well as any Python object that has a fileno()
function (sockets, files, etc.)
Currently, the interface is similar to the underlying zmq_poll
function. I am thinking about
providing a slightly different interface that would be more familiar
to Python devs and wanted
to get feedback.
The most familiar interfaces for non-blocking IO are select and poll.
Python comes with
an implementation of both of these things (OS dependent of course).
This is described here:
http://docs.python.org/library/select.html
I am thinking of wrapping my currently version of poll into two higher
level functions that
mimic Python's builtin select and poll interfaces:
* I would write a zmq.select function that has the same interface as
the built-in select.select but
calls zmq_poll underneath.
* I would create a simple Python object (Poller) that has the same
interface as the built-in select.poll.
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.
Cheers,
Brian
--
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