[ovs-dev] [PATCH v2] python/ovs/pollar: use select.select instead of select.poll

Isaku Yamahata yamahata at valinux.co.jp
Wed Sep 5 10:44:23 UTC 2012


On Tue, Sep 04, 2012 at 11:04:52PM -0700, Reid Price wrote:
> Seems reasonable.  Some notes inline, mostly nits and questions.

Thank you for review.


>     +class _SelectSelect(object):
>     +    """ select.poll emulation by using select.select.
>     +    Only register and poll are needed at the moment.
>     +    """
>     +    def __init__(self):
> 
> 
>  
> 
>     +        super(_SelectSelect, self).__init__()
> 
> This makes me think you are trying to something clever, when (I believe)
> you are not.  Was there any particular reason to include it?

Looking at python/ovs, I found that it's the style not to call
super class __init__(). Ok, I'll follow the style.


>     +        self.rlist = []
>     +        self.wlist = []
>     +        self.xlist = []
>     +
>     +    def register(self, fd, events):
>     +        if isinstance(fd, socket.socket):
>     +            fd = fd.fileno()
>     +        assert isinstance(fd, int)
>     +        if events & select.POLLIN:
>     +            self.rlist.append(fd)
> 
> 
>  
> 
>     +            events &= ~select.POLLIN
> 
> I assume this is more typical to write it as this general form than as
>  events -= select.POLLIN
> which is equivalent since you're already in the conditional

I think '&= ~' is a widely used idiom to drop a given bit.
-- 
yamahata



More information about the dev mailing list