def zadd(self, key, score, member, *pairs, exist=None):
        """Add one or more members to a sorted set or update its score.

        :raises TypeError: score not int or float
        :raises TypeError: length of pairs is not even number
        """
        if not isinstance(score, (int, float)):
            raise TypeError("score argument must be int or float")
        if len(pairs) % 2 != 0:
            raise TypeError("length of pairs must be even number")

        scores = (item for i, item in enumerate(pairs) if i % 2 == 0)
        if any(not isinstance(s, (int, float)) for s in scores):
            raise TypeError("all scores must be int or float")

        args = []
        if exist is self.ZSET_IF_EXIST:
            args.append(b'XX')
        elif exist is self.ZSET_IF_NOT_EXIST:
            args.append(b'NX')

        args.extend([score, member])
        if pairs:
            args.extend(pairs)
        return self.execute(b'ZADD', key, *args)
def zadd ( self , key , score , member , * pairs , exist = None ) : if not isinstance ( score , ( int , float ) ) : raise TypeError ( "score argument must be int or float" ) if len ( pairs ) % 2 != 0 : raise TypeError ( "length of pairs must be even number" ) scores = ( item for i , item in enumerate ( pairs ) if i % 2 == 0 ) if any ( not isinstance ( s , ( int , float ) ) for s in scores ) : raise TypeError ( "all scores must be int or float" ) args = [ ] if exist is self . ZSET_IF_EXIST : args . append ( b'XX' ) elif exist is self . ZSET_IF_NOT_EXIST : args . append ( b'NX' ) args . extend ( [ score , member ] ) if pairs : args . extend ( pairs ) return self . execute ( b'ZADD' , key , * args )
Add one or more members to a sorted set or update its score.

        :raises TypeError: score not int or float
        :raises TypeError: length of pairs is not even number