New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reverse iteration protocol #23972
Comments
Why not just have |
If |
@oscardssmith, yes, you'd get an error (probably |
I favor Keno's solution, since it also scales to different kinds of iterator orders. e.g, what if an iterator has efficient support for only iterating the even elements? Do we then need Also, I don't remember the issue, but there is an attempt to remove as many of these 'combinatorial' (in this case, 'reverse' x 'start, done') function names in Base as possible in favor of relying on dispatch. |
If we do this, that would likely simplify some stuff in my |
@ararslan, not quite, because |
As has been mentioned a few times, e.g. in #4590, #6165, and #23969, it would be nice if there were a standard reverse iteration protocol that iterators could support (if possible). @StefanKarpinski suggested
rstart
,prev
, andrdone
as not-terrible possibilities.You could then do e.g.
for x in Reverse(itr)
andReverse
(unlikereverse
) would implement non-materializing reverse iteration by callingrstart
etc. onitr
.The text was updated successfully, but these errors were encountered: