Iterators and Generators

Discussions compare iterators, generators, and related features like itertools across programming languages such as Python, Rust, Go, Nim, JavaScript, and Ruby, focusing on implementations, use cases, and alternatives.

📉 Falling 0.4x Programming Languages
3,272
Comments
20
Years Active
5
Top Authors
#3347
Topic ID

Activity Over Time

2007
5
2008
20
2009
45
2010
91
2011
124
2012
126
2013
231
2014
187
2015
189
2016
191
2017
158
2018
168
2019
184
2020
197
2021
287
2022
288
2023
316
2024
243
2025
214
2026
8

Keywords

Collectors.html e.g PHP US sep.join python.org ES6 ToArray mozilla.org AND python generators idiom generator loop iterating lazy loops method self

Sample Comments

jelder • May 31, 2025 • View on HN

This really just an argument for using iterator generators. Does Go offer those yet?

summarity • Mar 31, 2023 • View on HN

What's wrong with Nim's iterators?

saosebastiao • Jul 11, 2013 • View on HN

Are internal iterators still possible?

reinhardt • Nov 9, 2010 • View on HN

Or iterators/generators and itertools.

fulafel • Nov 20, 2015 • View on HN

Python iterators also give you lazy transformation and no intermediate data structures, no?

abritinthebay • Sep 21, 2017 • View on HN

A nice use case for sure. Seems possible with some kind of iterator/generator wrapper rather than the mess in the OP however.

saagarjha • Jun 2, 2019 • View on HN

Does JavaScript have adapters to covert lists into generators or lazy iterators?

seanconaty • Oct 11, 2013 • View on HN

You mentioned itertools twice. Accident or pun intended?

benwr • Nov 4, 2013 • View on HN

What about iterators/yield?

thomk • Jul 13, 2014 • View on HN

Typo in this sentence: However, it is also possible - in contrast to generators - to iterate over those multiple times if needed, it is aonly not so efficient.