Permalink
Browse files

use sets rather than dict comprehension

  • Loading branch information...
almet committed Aug 27, 2012
1 parent 300c987 commit 5bbd49436004ad6c5958f55197e958a470b155a1
Showing with 2 additions and 3 deletions.
  1. +2 −3 memcachepool/cache.py
View
@@ -48,9 +48,8 @@ def _pick_server(self):
if time.time() - age > self.blacklist_time:
del self._blacklist[server]
- # pick a server in the list
- choices = [server for server in self._servers
- if server not in self._blacklist]
+ # build the list of available servers
+ choices = list(set(self._servers) ^ set(self._blacklist.keys()))
if not choices:
return None

0 comments on commit 5bbd494

Please sign in to comment.