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?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RFT7CZTXFQVHXCS3RRKFAGOHQGOXK2JU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to