Friday, 30 March 2012

When to use OOP, when to use FP

As Python supports both OOP and FP styles, sometimes I find myself deciding which to use in various situations. OOP seems attractive when I have some sort of state (that cannot be avoided and must be managed) - this seems to occur mostly when dealing with stateful third-party APIs. In many other cases, a more FP oriented approach seems more attractive:- I am finding generators particularly handy & useful