[zeromq-dev] Question about python binding generator
Joe McIlvain
joe.eli.mac at gmail.com
Sat Nov 7 00:28:05 CET 2015
The reason that method is static/singleton (which in this case, we use
interchangably) is because the "self" argument does not have to be an
instance of `zsock_t` (it could also be a libzmq socket pointer already).
Essentially, the "self" argument can be any arbitrary object as far as the
bindings are concerned, and the return value is either a valid libzmq
socket pointer or NULL.
So, it can't use the python "self" as the self argument, because then you
couldn't pass in an arbitrary argument as the "self".
On Fri, Nov 6, 2015 at 6:52 AM, Arnaud Loonstra <arnaud at sphaero.org> wrote:
> Hi all,
>
> I'm a bit puzzled. For example if I use czmq's zsock in Python I can
> retrieve the underlying socket using the resolve method. This method is
> defined as a static method in Python:
>
> https://github.com/zeromq/czmq/blob/master/bindings/python/czmq.py#L2233
>
> The way it is defined I need to call (zsock instance s)
>
> s.resolve(s)
>
> Or if really done right
>
> Zsock.resolve(s)
>
> But is this correct? It doesn't seem like a static method? In zsock.xml
> it is defined as being a singleton and polymorphic.
>
> https://github.com/zeromq/czmq/blob/master/api/zsock.xml#L347
>
> Can anybody shred a light here? Is this the correct approach or is the
> generator defining the method as static incorrectly?
>
> Rg,
>
> Arnaud
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151106/d40d7829/attachment.htm>
More information about the zeromq-dev
mailing list