Re:Python to Scheme to Assembly (2014)
by adregan on Monday March 23, 2015 @11:10PM
(#9254685)
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.
[ Parent
| on HN ]
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!
I 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