Open drsasa opened 5 years ago
Generally this section is misleading.
I understand what writer wanted to say but its not correct.
map() returns an iterator not list. Therefore in text on few places is mentioned that map() returns list.
Therefore use case for map over list comprehension is let's say bit different and with map can be more memory efficient.
I'm just pointing out, so that section can be bit adjusted, but rest standing.
Generator expressions are lazy and (AFAIK) accepted anywhere a map object would be:
map
>>> ' '.join(map(str, range(5))) == ' '.join(str(i) for i in range(5)) True
Generally this section is misleading.
I understand what writer wanted to say but its not correct.
map() returns an iterator not list. Therefore in text on few places is mentioned that map() returns list.
Therefore use case for map over list comprehension is let's say bit different and with map can be more memory efficient.
I'm just pointing out, so that section can be bit adjusted, but rest standing.