2 ms·
> his "Stuff" example can be reduced to [...] The Python example is similarly unidiomatic, reduceable, and flawed for the sake of simplicity (the example doesn
by re 2y ago
> his "Stuff" example can be reduced to [...]
The Python example is similarly unidiomatic, reduceable, and flawed for the sake of simplicity (the example doesn't allow multiple independent Stuff iterators), so it's not like Ruby is really at a disadvantage in the article. The point of the example is to illustrate the mechanics of custom iteration (which forwarding to the encapsulated implementation wouldn't accomplish, for either language) while keeping the rest of the Stuff definition as simple as possible. But yes, a brief mention of including Enumerable wouldn't hurt.