title: Redis: How to parse a list result
body: <p>I am storing a list in Redis like this:</p>
  
  <pre><code>redis.lpush('foo', [1,2,3,4,5,6,7,8,9])
  </code></pre>
  
  <p>And then I get the list back like this:</p>
  
  <pre><code>redis.lrange('foo', 0, -1)
  </code></pre>
  
  <p>and I get something like this:</p>
  
  <pre><code>[b'[1, 2, 3, 4, 5, 6, 7, 8, 9]']
  </code></pre>
  
  <p>How can I convert this to actual Python list?</p>
  
  <p>Also, I don't see anything defined in <code>RESPONSE_CALLBACKS</code> that can help? Am I missing something?</p>
  
  <p>A possible solution (which in my opinion sucks) can be:</p>
  
  <pre><code>result = redis.lrange('foo',0, -1)[0].decode()
  
  result = result.strip('[]')
  
  result = result.split(', ')
  
  # lastly, if you know all your items in the list are integers
  result = [int(x) for x in result]
  </code></pre>
  
  <p><em><strong>UPDATE</em></strong></p>
  
  <p>Ok, so I got the solution.</p>
  
  <p>Actually, the <code>lpush</code> function expects all the list items be passed as arguments and NOT as a single list. The function signature from redis-py source makes it clear...</p>
  
  <pre><code>def lpush(self, name, *values):
      "Push ``values`` onto the head of the list ``name``"
      return self.execute_command('LPUSH', name, *values)
  </code></pre>
  
  <p>What I am doing above is send a single list as an argument, which is then sent to redis as a SINGLE item.</p>
  
  <p>I should be unpacking the list instead as suggested in the answer:</p>
  
  <pre><code>redis.lpush('foo', *[1,2,3,4,5,6,7,8,9])
  </code></pre>
  
  <p>which returns the result I expect...</p>
  
  <pre><code>redis.lrange('foo', 0, -1)
  [b'9', b'8', b'7', b'6', b'5', b'4', b'3', b'2', b'1']
  </code></pre>