title: Getting values with the right type in Redis
body: <p>I'm using redis in my python application to store simple values like counters and time stamp lists, but trying to get a counter and comparing it with a number I came across a problem.</p>
  
  <p>If I do:</p>
  
  <pre><code>import redis
  ...
  myserver = redis.Redis("localhost")
  myserver.set('counter', 5)
  </code></pre>
  
  <p>and then try to get that value like this:</p>
  
  <pre><code>if myserver.get('counter') &lt; 10:
       myserver.incr('counter')
  </code></pre>
  
  <p>then I get a type error in the if statement because I'm comparing '5' &lt; 10, which means <strong>I'm storing an integer value and getting a string one</strong> (which can be considered as a different value).</p>
  
  <p>My question is: is this supposed to work like that? I mean its a very basic type, I understand if I have to parse objects but an int? Seems that I'm doing something wrong.</p>
  
  <p>Is there any configuration I'm missing?</p>
  
  <p>Is there any way to make redis return the right type and not always a string?
  I say this because its the same for lists and datetimes or even floating point values.</p>
  
  <p>Could this be a problem with the redis-py client I'm using and not redis itself?</p>