[Neo-report] r2012 vincent - /trunk/neo/event.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Apr 23 10:47:39 CEST 2010
Author: vincent
Date: Fri Apr 23 10:47:37 2010
New Revision: 2012
Log:
Simplify code: iterate over unique entries rather than skipping duplicates.
Modified:
trunk/neo/event.py
Modified: trunk/neo/event.py
==============================================================================
--- trunk/neo/event.py [iso-8859-1] (original)
+++ trunk/neo/event.py [iso-8859-1] Fri Apr 23 10:47:37 2010
@@ -101,11 +101,7 @@
def _poll(self, timeout=1):
rlist, wlist, elist = self.epoll.poll(timeout)
- r_done_set = set()
- for fd in rlist:
- if fd in r_done_set:
- continue
- r_done_set.add(fd)
+ for fd in frozenset(rlist):
conn = self.connection_dict[fd]
conn.lock()
try:
@@ -115,11 +111,7 @@
if conn.hasPendingMessages():
self._addPendingConnection(conn)
- w_done_set = set()
- for fd in wlist:
- if fd in w_done_set:
- continue
- w_done_set.add(fd)
+ for fd in frozenset(wlist):
# This can fail, if a connection is closed in readable().
try:
conn = self.connection_dict[fd]
@@ -132,11 +124,7 @@
finally:
conn.unlock()
- e_done_set = set()
- for fd in elist:
- if fd in e_done_set:
- continue
- e_done_set.add(fd)
+ for fd in frozenset(elist):
# This can fail, if a connection is closed in previous calls to
# readable() or writable().
try:
More information about the Neo-report
mailing list