26 Jul
2019
26 Jul
'19
10:05 p.m.
Andrew Barnert wrote:
consume(print(item) for item in lst)
From my understanding, consume() effectively provides the functionality the author was looking for. Also, between the options of `for _ in iter:` vs `colllections.deque(it, maxlen=0)`, how significant is the performance difference? I had assumed that the performance of `for _ in iter` would be significantly better, since due to the overhead cost of creating and filling a double ended queue, which provides optimization for insertion at the beginning and end. Wouldn't a one directional iterator provide better performance and have a lower memory cost if there is no modification required?