DEV Community

Discussion on: Functional programming in python

Collapse
 
aswinbarath profile image
Aswin Barath • Edited

@cappe987 , you are correct at the end that Map, filter, and reduce will be pure only if we pass it pure functions.

At the end of the day, what we need to understand is that these useful functions follow the properties of Functional Programming paradigm.

And any given code, here these functions, comes with pros and cons too.

So, it's all about how the developer approaches on coding these concepts.

Collapse
 
cappe987 profile image
Casper

Yes. I just wanted to point out that they aren't inherently pure. At least not in Python. In Haskell the type system can force purity of a function, so those functions would be guaranteed to be pure because side effects are encoded in the types.

Thread Thread
 
aswinbarath profile image
Aswin Barath • Edited

Yeah, Haskell is a statically & strongly typed language
compared to python which is dynamically & strongly typed language.
So, in that case, you are right about Haskell.

Hence it all comes down to choosing a language proactively by understanding the trade-offs and should be able to clearly comprehend the pros and cons, to make sure that one can deliver quality software.

So at the end of the day, this is what makes a developer distinguished among the community, the one who don't form strong opinions on a particular technology rather understand the pros and cons of each technology.

@cappe987 Thank you for pointing that out and stay tuned to learn more on python from my future blogs :)