[nanomsg] Re: Alpha Python bindings.

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Wed, 28 Aug 2013 09:43:16 +0200

Ok. Fair enough.

Martin

On 28/08/13 09:30, Paul Colomiets wrote:
Hi,

One more comment

On Wed, Aug 28, 2013 at 10:25 AM, Paul Colomiets <paul@xxxxxxxxxxxxxx> wrote:
Hi Martin,

On Wed, Aug 28, 2013 at 7:38 AM, Martin Sustrik <sustrik@xxxxxxxxxx> wrote:
On 28/08/13 01:30, Paul Colomiets wrote:

I guess for high level API
you should make a class for each socket type, and a method/property
for each socket option anyway, so that user don't need to use
constants anyway.


What's the upside of such approach?


Clarity. The subscription in C looks like:

nn_setsockopt(s, NN_SUB, NN_SUB_SUBSCRIBE, "ABC", 3)

In Python it should look like:

s.subscribe("ABC")

And obviously only SUB socket type should have method subscribe().


And as it is high level interface it should probably have high level
methods like
sock.request() for REQ that does request and returns reply and
sock.survey() for SURVEYOR
that returns iterator over replies. And so on.



Other related posts: