From 5611b30022fbe6c2b91ffb145d604f3c07ff6898 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 22 Jul 2014 11:16:06 +0200 Subject: Use ".remove()" instead of "is in" followed by ".pop()" --- slixmpp/xmlstream/xmlstream.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/slixmpp/xmlstream/xmlstream.py b/slixmpp/xmlstream/xmlstream.py index 8552dc6b..838f3649 100644 --- a/slixmpp/xmlstream/xmlstream.py +++ b/slixmpp/xmlstream/xmlstream.py @@ -650,11 +650,9 @@ class XMLStream(object): # remove it now instead of waiting for it to be # processed in the queue. try: - h_index = self.__event_handlers[name].index(handler) - except: + self.__event_handlers[name].remove(handler) + except ValueError: pass - else: - self.__event_handlers[name].pop(h_index) def schedule(self, name, seconds, callback, args=tuple(), kwargs={}, repeat=False): -- cgit v1.2.3