i'm looking for something that can do like this
span()
function can:1 2 3 4 5 6 |
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.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.