Dec-29-2019, 12:06 AM
i'm looking for something that can do like this
span()
function can:a = ['foo','bar','boo','far','baz'] for b in span(a,3): print(*b) a = [1,2,3,4,5,6,7,8,9] for b in span(a,4): print(*b)
Output:foo bar boo
bar boo far
boo far baz
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
5 6 7 8
6 7 8 9
this shouldn't be hard to code, but if zip()
exists, maybe something like this span()
exists. if it would return an iterator, that would be fine.