12 January 2016

Functional Python Programming

I always wanted to know what was about that thing called functional programming, but I didn't want top learn a new language to understand functional programming, not now at least. So when a found a book dealing the topic (Functional Python Programming by Steven Lott) from a Python focus I read it.

After reading it I feel that I've been following a lot of functional programming principles without even realizing it: short functions, don't alter outer states from inside a function, use iterators (lazy-evaluation) wherever possible, etc. That doesn't mean I didn't learn anything, for instance I really enjoyed the examples about features in itertools library which I hadn't used so far.

It includes some advices I'm not going to follow, like the one about chaining functions. The book really like function chaining (you know, inserting a function call as a parameter for another function) but doing that you end with really long line codes that I feel entirely un-pythonic. Besides, they really like recursion but I fell unconfortable with that concept and to be honest I didn't understand the books example about tail optimizations.

Nevertheless the book is extensive, systematic and includes a lot of example so I think it's worth reading it to get some concepts to improve your overall coding skills.