r/Python • u/ajkumar25 • Dec 24 '13
Functional Programming in Python
http://pypix.com/python/functional-programming/
0
Upvotes
3
u/TimMcD0n41d Dec 24 '13
5 up and 5 down I had no idea Functional programming was so controversial.
2
u/ralfp misago Dec 24 '13
The site and submitter are somehow controversial subjects recently on r/python.
3
u/catcradle5 Dec 24 '13
print { name[0].upper() + name[1:].lower() for name in names if len(name) > 1 }
You can use str.title() instead, assuming each string is supposed to have one word.
print { name.title() for name in names if len(name) > 1 }
4
u/codygman Dec 24 '13
I'm not sure if you meant it (and thought you'd correct it later in the article), but Haskell does let you have side effects.
Great article though. As a fan of racket, haskell, ocaml, and clojure I approve of using functional idioms in python :D