diff --git a/src/tqdm_publisher/publisher.py b/src/tqdm_publisher/publisher.py index ab53463..9fe36c5 100644 --- a/src/tqdm_publisher/publisher.py +++ b/src/tqdm_publisher/publisher.py @@ -27,8 +27,7 @@ def subscribe(self, callback): # Unsubscribe from updates def unsubscribe(self, callback_id): - try: - del self.callbacks[callback_id] - return True - except KeyError: - return False \ No newline at end of file + if callback_id not in self.callbacks: + return False + del self.callbacks[callback_id] + return True \ No newline at end of file