4 ms·
This was the worst thing about switching to Python 3. `map` and `filter` are annoyingly "lazy" and `reduce` is basically shunned. I wonder if the real reason t
by _callcc 12y ago
This was the worst thing about switching to Python 3. `map` and `filter` are annoyingly "lazy" and `reduce` is basically shunned.
I wonder if the real reason this was changed was to discourage the use of `map` and `filter`... wrapping them each time with `list` is a pain in the ass and hurts readability.
And it breaks code in hard to anticipate places if you don't.
First thing I do when starting something is change them back in global scope. If I want a generator, I'll write one...
Down with PEP 8!
- mkesper 12y agoI think Guido makde it very clear he does not favour any use of map/reduce.
- cbsw 12y agoI don't think "lazy" is a problem in real code. They just annoys when in interactive shell which you just want to print their result. In fact python3 has changed a lot of list like data type or function to "lazy", zip(),dict.items() etc. IMO this helps a lot to reduce memory usage. Thus more efficient with functional programming