Why doesn\'t following code print anything:
#!/usr/bin/python3
class test:
def do_someting(self,value):
print(value)
return value
de
Before Python 3, map() returned a list, not an iterator. So your example would work in Python 2.7.
list() creates a new list by iterating over its argument. ( list() is NOT JUST a type conversion from say tuple to list. So list(list((1,2))) returns [1,2]. ) So list(map(...)) is backwards compatible with Python 2.7.