2 ms·
I was aware of generators in python, but I wasn't aware of the lazy lest comprehensions, which is very nice. I agree list comprehensions in the simple form are
by kbenson 10y ago
I was aware of generators in python, but I wasn't aware of the lazy lest comprehensions, which is very nice.
I agree list comprehensions in the simple form are easier for a newbie to recognize, but I also like the way map and filter make you think about your actions, and think they are clearer in the less trivial cases (as I mentioned above). I say "filter" because while I am completely familiar with that terminology, I accept that it's an unneeded departure from the common terminology for that task.
- icebraining 10y agoWell, map and filter may be more clear in certain cases, but I still don't see how they are more powerful. Seems like you can do a 1-for-1 translation between the two.
- kbenson 10y agoOh, that's because you must have missed a few comments back where I agreed with you and backed out on any claim they were strictly more powerful. ;)
- icebraining 10y agoAh, uh, sorry ;)