3 ms·
Closures aside, a somewhat significant difference between the two is that the generator would yield each value in the sequence, whereas yours would just return
by dvlsg 10y ago
Closures aside, a somewhat significant difference between the two is that the generator would yield each value in the sequence, whereas yours would just return a single value from the sequence. Which might be perfect, depending on the use case, but they're not quite the same.