From 50cee5ede8556a18104dda9efd7ec6d46356c841 Mon Sep 17 00:00:00 2001 From: Oleg Anashkin Date: Wed, 19 Jun 2013 17:43:45 -0700 Subject: [PATCH] Combine two ifs into a single line --- twython/streaming/api.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/twython/streaming/api.py b/twython/streaming/api.py index 9545935..244a550 100644 --- a/twython/streaming/api.py +++ b/twython/streaming/api.py @@ -114,9 +114,8 @@ class TwythonStreamer(object): for message_type in self.handlers: if message_type in data: handler = getattr(self, 'on_' + message_type, None) - if handler and callable(handler): - if not handler(data.get(message_type)): - break + if handler and callable(handler) and not handler(data.get(message_type)): + break except ValueError: self.on_error(response.status_code, 'Unable to decode response, not valid JSON.')