From 3edccee4a18197da0436a6d2d33269190d07ed54 Mon Sep 17 00:00:00 2001 From: Alireza Date: Mon, 9 Oct 2017 11:03:35 +0330 Subject: Added number of members to be popped from set, by spop command --- redis/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redis/client.py b/redis/client.py index e3b5ed7..79e94d0 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1642,9 +1642,10 @@ class StrictRedis(object): "Move ``value`` from set ``src`` to set ``dst`` atomically" return self.execute_command('SMOVE', src, dst, value) - def spop(self, name): + def spop(self, name, count=None): "Remove and return a random member of set ``name``" - return self.execute_command('SPOP', name) + args = (count is not None) and [count] or [] + return self.execute_command('SPOP', name, *args) def srandmember(self, name, number=None): """ -- cgit v1.2.1