I'm confused by this statement. As I understand it, list comprehensions exist to transform data. Inline functions in JS would be equal to lambdas in python, I.e. anonymous functions. So what differences between JS and python do you think is missing?
I'm confused by this statement. As I understand it, list comprehensions exist to transform data. Inline functions in JS would be equal to lambdas in python, I.e. anonymous functions. So what differences between JS and python do you think is missing?
Lambdas are incredibly limited and encourage the declaration of a whole separate function that now lives physically far from its use.
List comprehensions are also really underpowered and I personally hate the map and filter functions and their goofy list-like types.
Check out linq in .net, streams in Java, array in JS, collections in scala to see the expressive power of a fluent interface on collections
Why are you doing that? Just declare the (named) function right there where you’re gonna use it. If it’s any endorsement CPython does it all the time.
> I personally hate the map and filter functions and their goofy list-like types.
You mean iterators? There’s nothing else they could possibly return. Map and filter are lazy and work with arbitrary iterables even ones that never end or have no possible way to define bind.
I think a lot of people have no idea nested functions exist in python...