hi:
I use libevent-python package currently. I read the file eventmodule.c, but I can not understand the function:

static EventObject *EventBase_CreateEvent(EventBaseObject *self, PyObject *args, PyObject *kwargs)
 {
   EventObject *newEvent = NULL;

   newEvent = (EventObject *)Event_New(&Event_Type,NULL,NULL);

   if (Event_Init(newEvent, args, kwargs) < 0){
     return NULL;
   }

if (PyObject_CallMethod((PyObject *)newEvent, "setEventBase", "O", self) == NULL){
     return NULL;
   }

   return newEvent;
 }

So, I can not know the param "EventBaseObject *self" is what? And I read the examples/echo_server.py file, I read the follow source:
   class BaseConnection(object):
    bufferSize = 2**16
    def __init__(self, sock, addr, server):
        self.sock = sock
        self.addr = addr
        self.server = server
        self.sock.setblocking(False)
        self.buf = []
        self.readEvent = libevent.createEvent(
            self.sock,libevent.EV_READ|libevent.EV_PERSIST, self._doRead)
        self.writeEvent = libevent.createEvent(
            self.sock,libevent.EV_WRITE, self._doWrite)
        self.startReading()
 So, I can not see pass the self parameter. Is anybody know this?

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to