3 ms·
Although I agree it was an interesting read and I do like this language feature, I think generators should be used with caution since they might detract from th
by rlander 16y ago
Although I agree it was an interesting read and I do like this language feature, I think generators should be used with caution since they might detract from the code's readability (especially generator expressions). Some async libraries like dieselweb just use them too much for my taste.
- ntoshev 16y agoGenerators actually allow you to decouple code in more ways than normal functions and classes let you. See the "Why functional programming matters" paper, or the more practical presentation here: http://www.dabeaz.com/generators/Generators.pdf http://www.dabeaz.com/generators/Generators.pdf
- rlander 16y agoWow, excellent resource, definitely a must-read. However, I still stand by my opinion that there are more intuitive ways to control flow in python other than generator tricks.