4 ms·
Python 3 really pushes you towards list comprehensions as you have to wrap your filter in a list(). I ended up just going with the flow. However, nesting list c
by adregan 12y ago
Python 3 really pushes you towards list comprehensions as you have to wrap your filter in a list(). I ended up just going with the flow. However, nesting list comprehensions can get me into a place where I forget what it is I'm doing.
- _callcc 12y agoThis 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