Comment on PEP-0322: Reverse Iteration Methods
Chad Netzer
cnetzer at sonic.net
Fri Sep 26 15:26:47 EDT 2003
On Fri, 2003-09-26 at 11:42, Sean Ross wrote:
> > I was questioning the feasibility of the implied semantics.
>
> Fine. Take it up with the person who proposed the idea.
You proposed it (hear me out). You are missing David's point. In
addition to whatever semantics a general reverse iterator might have, he
is saying that the itertools iterators have an implied additional
semantic of not (necessarily) needing to fully expand an iterable in
memory to operate on it, as a general ireverse() would probably have to
do. So, having ireverse potentially use up VAST quantities of memory,
in order to work, doesn't quite fit into the itertools philosophy.
That is the point he is making, and it is a specific comment on your (I
believe; others have probably proposed it as well) suggestion of an
ireverse() in itertools.
Now, my response to David's point is that currently, cycle() may also
require enough extra storage to remember an entire iterated sequence, so
the itertools philosophy is not a hard rule. Still, ireverse() would
imply some real devilry under the covers...
--
Chad Netzer
More information about the Python-list
mailing list