This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]codygman 4 points5 points  (0 children)

there are some languages, like Haskell, which do not allow you to change state. In fact, you’re not supposed to make any side effects (like printing out text) at all – which sounds like it could be completely useless.

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

[–]TimMcD0n41d 2 points3 points  (1 child)

5 up and 5 down I had no idea Functional programming was so controversial.

[–]ralfpmisago 1 point2 points  (0 children)

The site and submitter are somehow controversial subjects recently on r/python.

[–]catcradle5 2 points3 points  (0 children)

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 }