Browse files

Change a for loop to use enumerate in order to be a bit cleaner

  • Loading branch information...
1 parent 3f6d80a commit 728e7be4a1cc6559c972389926c0da7a1009e96d @jasongrout jasongrout committed Apr 22, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 ip_receiver.py
View
6 ip_receiver.py
@@ -26,9 +26,9 @@ def getMessages(self, parent_header, block=False):
except zmq.core.error.ZMQError: # No more messages
break
toDel=set()
- for i in range(len(self.messages)):
- if self.messages[i]['parent_header']==parent_header:
- results.append(self.messages[i])
+ for i,msg in enumerate(self.messages):
+ if msg['parent_header']==parent_header:
+ results.append(msg)
toDel.add(i)
self.messages[:]=[self.messages[i] for i in range(len(self.messages)) if i not in toDel]
if not block or len(results):

0 comments on commit 728e7be

Please sign in to comment.