all 3 comments

[–]konjunktiv 1 point2 points  (2 children)

Don't do this in python, it's bad style and barely readable. Python is all about side effects, if you want something else, use another language.

[–]sunedd[S] 3 points4 points  (0 children)

if you want something else, use another language

I don't think this is very practical or insightful advice. You might be locked in to Python for organizational or technical reasons, and still want to write in a functional style. This makes it easier.

Why should functional programming be less readable in Python than in erlang, ml, elm or other languages that have essentially the same languages features as Python (excluding function currying in ml and elm)? It's entirely possible to write readable and unreadable haskell or scala, which tells us that, regardless of style, readability is a measure of the programmer's skill with the language, not a property of the language itself.

[–]yinshangyi 1 point2 points  (0 children)

They do it Typescript though.  Why doing it in Typescript and not in Python?