You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Gah, I copy/pasted and forgot to actually remove the map() call. The values should come back as strings, just how redis.get() would return. Fix pushed in 5723a54.
dbravender
pushed a commit
to dbravender/redis-py
that referenced
this issue
May 6, 2014
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.
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?
Anyway, thought I would let you know =]
Cheers
Sam
The text was updated successfully, but these errors were encountered: