Description
Heya Andy, thanks for the speedy turnaround on the new hash functions. I notice however that the pairs_to_dict function is forcing values to be cast as float via a map call. Is this intended? It means I can't put string values into a hash.
r.hset('foo', 'bar', 'zoo')
1
r.hgetall('foo')
Traceback (most recent call last):
File "", line 1, in
File "redis/client.py", line 902, in hgetall
File "redis/client.py", line 325, in format_inline
File "redis/client.py", line 247, in execute_command
File "redis/client.py", line 242, in _execute_command
File "redis/client.py", line 310, in parse_response
File "redis/client.py", line 207, in
File "redis/client.py", line 158, in pairs_to_dict
ValueError: invalid literal for float(): zoo
Not sure what side effect there would be from removing the float call - other than everything coming back as a string. Maybe instead of mapping to float, it could use a function like this?
def map_type(value):
... try:
... return '.' in value and float(value) or int(value)
... except ValueError:
... return value
Anyway, thought I would let you know =]
Cheers
Sam