Skip to content
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

hasNext #45

Open
dselivanov opened this issue Nov 1, 2015 · 1 comment
Open

hasNext #45

dselivanov opened this issue Nov 1, 2015 · 1 comment

Comments

@dselivanov
Copy link

Do you have plans to implement hasNext method (similar to itertools::hasNext)?
EDIT: Also itertools::ihasNext() is very useful.

@ramhiser
Copy link
Owner

ramhiser commented Nov 2, 2015

@dselivanov I have thought about creating a hasNext that is similar to itertools::ihasNext(). The implementation in itertools goes against the concept of an iterator because it maintains state. While it may be useful for some use cases, I am not fond of the caching it performs when determining whether another element is available. For a large cached chunk, say, a large data.frame queried from a database, the cache may be excessively large in terms of memory.

It may be possible though to implement such an approach with itertools2::itee. I'd be open to a PR with a suggested implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants