Python Forum
popping an iterator - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: popping an iterator (/thread-35129.html)

Pages: 1 2


RE: popping an iterator - ndc85430 - Oct-03-2021

Again, given that iterators include generators, how exactly would reversing them work?


RE: popping an iterator - Skaperen - Oct-03-2021

(Oct-02-2021, 05:55 PM)ndc85430 Wrote: Also, what would you think should happen if the iterator was infinitely long?

what if the value passed to range() was extraordinarily high, such as 2**64? i know i would not take much memory, but what about time? we do make faster computers, but we still manage to run out of it on a regular basis. i think we know what to with software that is running and producing no results.
reversing an iterator has its limits. memory may be a frequent one. time may also be. imagine a computer so larg that it takes hours to clear memory to all zeroes.

imagine a new type of iterator with a method to access data from each end? imagine one that supports random access.