3 ms·
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.
by jletts 6y 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.
- jakear 6y agoYou’re saying it’d be more Pythonic to not use list comprehensions? I find that doubtful.
- jakear 6y agoAlso this is still confusing because you need to read it backwards. Pipelines are just better in every way, if you ask me.
- dagw 6y agoFunny 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.