The author's Python example is a straw man. You can write generator expressions that way... if you hate yourself and all the people who will have to deal with your code.
The Go alternative that's provided, if that's one's stylistic preference, is just as easily implemented in Python as it is in Go.
To my eyes neither the Go nor the Python implementations in the article are beautiful.
In any case, despite his bagging of Python, it seems like the author would agree with the Zen of Python:
Flat is better than nested.
Sparse is better than dense.
Readability counts.
3 comments
[ 2.9 ms ] story [ 19.1 ms ] threadWe can test it by comparing the lines of code in non-trivial Python programs on GitHub with equivalent programs written in Go.
The Go alternative that's provided, if that's one's stylistic preference, is just as easily implemented in Python as it is in Go.
To my eyes neither the Go nor the Python implementations in the article are beautiful.
In any case, despite his bagging of Python, it seems like the author would agree with the Zen of Python:
Flat is better than nested. Sparse is better than dense. Readability counts.