Hi,
I have a list and I loop it:
grab first item and do something with each item in the list
after that is done: no more need for first item.
grab second item and do something with each remaining item in the list
after that is done: no more need for second item.
etc
To visualize it:
[1,2,3,4,5]
1 will do something with 2,3,4,5 .... and drops 1
now the list is 2,3,4,5
2 will do something with 3,4,5 .... and drops 2
now the list is 3,4,5
itertool combinations makes a new list with all the unique combinations. Which kinda is what I'm doing HOWEVER given a list of thousands+ I THINK it's faster to yield the original list and somehow drop used item.
Makes sense? Curious how to do this.
I have a list and I loop it:
grab first item and do something with each item in the list
after that is done: no more need for first item.
grab second item and do something with each remaining item in the list
after that is done: no more need for second item.
etc
To visualize it:
[1,2,3,4,5]
1 will do something with 2,3,4,5 .... and drops 1
now the list is 2,3,4,5
2 will do something with 3,4,5 .... and drops 2
now the list is 3,4,5
itertool combinations makes a new list with all the unique combinations. Which kinda is what I'm doing HOWEVER given a list of thousands+ I THINK it's faster to yield the original list and somehow drop used item.
Makes sense? Curious how to do this.