Feb-17-2022, 01:32 AM
if you iterate a list twice, the 2nd time has all the data from the beginning. but what if you have a case where the data can be figured out as an iterator and would be too large for memory, but you need to iterate it 2 or more times. an example test case would be range() or an equivalent that yields squares of sequence of ints (0,1,4,9,16,...)
for those who like to see code:
for those who like to see code:
def range2(*a): for x in range(*a): yield x*x return Noneyeah, that was absurdly simple.
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.