From 3959c4fdca40346caf40aaba9adadd9e0772bfa0 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 22 Jul 2019 20:25:53 -0400 Subject: [PATCH] simplify check for non-zero content in set() There's no point in casting to list just to compare to [], since set/list/tuple will evaluate to false when empty. So we can do less work in fewer characters. --- src/calibre/gui2/email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/email.py b/src/calibre/gui2/email.py index 8b07edaa3e..1f348af3f5 100644 --- a/src/calibre/gui2/email.py +++ b/src/calibre/gui2/email.py @@ -429,7 +429,7 @@ class EmailMixin(object): # {{{ dbfmts = self.library_view.model().db.formats(id, index_is_id=True) formats = [f.lower() for f in (dbfmts.split(',') if dbfmts else [])] - if list(set(formats).intersection(available_input_formats())) != [] and list(set(fmts).intersection(available_output_formats())) != []: + if set(formats).intersection(available_input_formats()) and set(fmts).intersection(available_output_formats()): auto.append(id) else: bad.append(self.library_view.model().db.title(id, index_is_id=True))