[nanomsg] Re: Alpha Python bindings.

  • From: Paul Colomiets <paul@xxxxxxxxxxxxxx>
  • To: Martin Sustrik <sustrik@xxxxxxxxxx>
  • Date: Wed, 28 Aug 2013 10:25:14 +0300

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().

> The downside, obviously, is that any change to the library (new protocol,
> new socket option) would require a change to the binding. Consequently, the
> binding won't be in sync with the lib all the time, more maintenance work
> will be required etc.
>

The patterns and socket options are not added every other day. It's
not that hard. And you can use low level interface for whatever not
implemented yet.

--
Paul

Other related posts: