Hacker News new | ask | show | jobs
by jletts 2244 days ago
map(lambda x:x^2, filter(lambda x:x%6==0, map(lambda x: x*2, getNumbers())))

Would probably be a more pythonic way to do that, avoiding list comprehensions. Easier to read with added lines and indentation.

But tbf I do appreciate the ability to chain operations in JS without subclassing objects like list.

3 comments

Funny how 'pythonic' can mean different things to different people. I've been developing in python on and off for the best part of a decade, and in my world comprehensions are considered far more 'pythonic' than map/filter/lambda.
Also this is still confusing because you need to read it backwards. Pipelines are just better in every way, if you ask me.
You’re saying it’d be more Pythonic to not use list comprehensions? I find that doubtful.