Skip to content

Avoid functional paradigm & lambda expressions in Python

github logo ・1 min read  

If you love functional programming and want to apply functional approaches to python, just don't.

Although Python supports multiple programming paradigms like procedural, declarative and OOP, it was particularly never designed as a functional language. You can find some code smells that arise from trying to apply functional style to python here.

twitter logo DISCUSS (4)
markdown guide

I didn't see a strong point there tbh. No word of performance impact or bugs.
Using list comp instead of map doesn't make is less functional either in my eyes.
Functional programming is more than map and filter.

Python has in fact functional capabilities. This is because functions are first class citizens. They are expressions which can be evaluated at runtime. They can be passed as argument and you can return them from other functions. They can 'remember' things in closure.

On top of that functional programming is also a way to think. Avoiding side effects and mutations for example are things you can probably always benefit from in some way if its not too strictly and mechanically enforced.


Lambdas and currying can be really powerful for map and for multiprocessing. Lambdas are alot like ternaries where they get really hard to grok really fast.

While I'm glad that you are aware of these principles and that you have formed opinions on their usage, I don't feel like this post really offers anything helpful to others. Please consider including more material in your future posts beyond "I think X, you should think X"


Python's currying is hacky and it doesn't support tail recursion at all. So striving to write functions without implicit states, bullishly avoiding OOP foster over-engineered mess that achieve nothing but functional purity.

The whole idea is to discourage people from writing Lisp, Haskelish code that is hard to debug and causes heated debate during code review.

The whole, "I think X" in case of functional paradigm was stated by Guido himself and he explicitly stated in a Q/A against writing lambdas, map, filter, reduce.
Sure, his opinion doesn't add anything at all.

And the link's content is also written by me. Didn't want to repeat the same thing here again.


I feel like dropping links here instead of using the rss feed pickup doesn't feel like a proper use of this platform.

Classic DEV Post from Jun 1 '19

Demystifying Open Source Contributions

This quick guide is mainly for first-time contributors and people who want to start helping open sour...

Redowan Delowar profile image
Abstraction Compiler | Python Aficionado | Data Scientist @HelloShopUp