Open combatpoodle opened 7 years ago
Good find, thanks!
Parsing "NX"
, "CH"
, ... from *args
would be obscure and non-obvious API to my taste.
I'd prefer boolean kwargs: zadd("key", 2, "two", 3, "three", nx=True)
. Unfortunately, we can't have keyword args after *args
in Python 2, but it can be simulated with **kwargs
like this:
def zadd(self, key, score, member, *args, **kwargs):
nx = kwargs.get('nx', False)
...
what do you think?
👍
Issue
I had some issues with ZADD not actually adding values to the set if NX was set on redis > 3.0.2. When XX, NX, CH, or INCR was used they were interpreted to be the score and were then intermingled with extra pairs of arguments throughout the function.
Workaround
Just stripping out zadd's internals does get it working:
Solution
By the previous behavior I'm guessing you want to keep the error checking in there - would you like it re-added and PR'd with a check for NX/CH/XX/INCR?