inherent syntax of the language and takes more manual construction given the get_primes(generator function discussed earlierwe might write our own container to simulate the same thingfor examplefrom collections abc import sequence class expandingsequence(sequence)def __init__(selfit)self it it self _cache [def __getitem__(selfindex)while len(self _cache<indexself _cache append(next(self it)return self _cache[indexdef __len__(self)return len(self _cachethis new container can be both lazy and also indexibleprimes expandingsequence(get_primes()for _p in zip(range( )primes)print(pend=" primes[ primes[ len(primes primes[ len(primes of coursethere are other custom capabilities we might want to engineer insince lazy data structures are not inherently intertwined into python maybe we' like to be able to slice this special sequence maybe we' like prettier representation of the object when printed maybe we should report the length as inf if we somehow signaled it was meant to be infinite all of this is possiblebut it takes little bit of code to add each behavior rather than simply being the default assumption of python data structures lazy evaluation