summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2010-08-19 09:03:51 -0700
committerAndy McCurdy <andy@andymccurdy.com>2010-08-19 09:03:51 -0700
commit16c0eff87e7762d82fdd37d9949e33a7376d5357 (patch)
tree9e8e8d4e4853dff593508f3d9bb1c299b83f7b7b /redis/client.py
parent91c0e61041dcce7aeeff14b47fe1d7865937c265 (diff)
downloadredis-py-16c0eff87e7762d82fdd37d9949e33a7376d5357.tar.gz
slight optimization to hmset, mset, and msetnx for both clarity and speed
Diffstat (limited to 'redis/client.py')
-rw-r--r--redis/client.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/redis/client.py b/redis/client.py
index 3e22615..0e3cac9 100644
--- a/redis/client.py
+++ b/redis/client.py
@@ -587,7 +587,8 @@ class Redis(threading.local):
def mset(self, mapping):
"Sets each key in the ``mapping`` dict to its corresponding value"
items = []
- [items.extend(pair) for pair in mapping.iteritems()]
+ for pair in mapping.iteritems():
+ items.extend(pair)
return self.execute_command('MSET', *items)
def msetnx(self, mapping):
@@ -596,7 +597,8 @@ class Redis(threading.local):
none of the keys are already set
"""
items = []
- [items.extend(pair) for pair in mapping.iteritems()]
+ for pair in mapping.iteritems():
+ items.extend(pair)
return self.execute_command('MSETNX', *items)
def move(self, name, db):
@@ -1144,7 +1146,8 @@ class Redis(threading.local):
in the hash ``name``
"""
items = []
- [items.extend(pair) for pair in mapping.iteritems()]
+ for pair in mapping.iteritems():
+ items.extend(pair)
return self.execute_command('HMSET', name, *items)
def hmget(self, name, keys):