+ 28
Py: why method "map" have to need "list"?
Python metods
4 Answers
+ 5
The very idea of map function implies that it has a list as an argument. Mapping a scalar has no sense since you can do it with a simple function. Map means to run a said function through the iterable (list) and map means to return an iterator. Of course your list may consist of one value but it doesn'matter.
+ 20
strawdog đ·đș I thought that the map returns a class object. so it must be brought to normal.
+ 3
map used to create a list in Python 2 but was changed in Python 3 to be an iterator, or an object which iterates through an iterable to produce the values one at a time. this prevents duplication of data and thus saves on memory.
+ 1
Friend 4 Goodmen , map function returns a map object (class map), which is an iterator. You can either enclose it into an iterable (like list) or strictly iterate through is values.