DEV Community

loading...

Discussion on: Map vs List comprehension in Python

Collapse
grayjack profile image
GrayJack

Well, I agree with you when talking about python, but in the end, it depends how each language was implemented.

R for example have way faster functional style code than the same in imperative style.

Rust have similar speeds with both functional and imperative styles. Some data types may have drawbacks in one of the 2 styles, but all primitive types and most of the std data structures don't.

I fell that deep down in python implementation, list comprehension are implemented in what python is better at (or more optimized at), imperative paradigm.

I fun test could be R list comprehension vs R map, plus comparing with python and looking at their implementations deep down in the language.

I may do that at some point in my life. XD