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
{{ message }}
This repository was archived by the owner on Dec 29, 2021. It is now read-only.
N = 31
nums = get_list(key)
for i in range(N):
nums.append(i)
back = [e for e in nums]
assert len(nums) == N
print(">> back's length:", len(back))
assert len(back) == N
Output:
>> back's length: 32
Traceback (most recent call last):
File "./list_fails.py", line 35, in <module>
fails()
File "./list_fails.py", line 25, in fails
assert len(back) == N
AssertionError
"Note that if you have a list of numbers from 0 to 100, LRANGE list 0 10 will return 11 elements, that is, the rightmost item is included. This may or may not be consistent with behavior of range-related functions in your programming language of choice (think Ruby's Range.new, Array#slice or Python's range() function)."
Hi,
Iteration over a list contains a bug:
Output:
The problem is in this function: https://github.com/Doist/redis_wrap/blob/master/redis_wrap/redis_list.py#L41 . Whenever you add 30, you introduce a duplicate.
From the Redis docs (http://redis.io/commands/LRANGE):
"Note that if you have a list of numbers from 0 to 100, LRANGE list 0 10 will return 11 elements, that is, the rightmost item is included. This may or may not be consistent with behavior of range-related functions in your programming language of choice (think Ruby's Range.new, Array#slice or Python's range() function)."