+ 2
Map question
def a(x): return x+5 nums=[11,22,33,44,55] b = map(a,nums) print(b) >>> <map=0Ă010BA510> What's that output??
5 Answers
+ 3
No problem.
Explanation:
Because map is not a simple dictionary, list or anything like that, it cannot be displayed.
When you try to print an object that is not any of those base types, it calls the __repr__ method, which is by default <fn=addres-in-memory>, but can also be overridden if necesarry.
+ 3
yeah, but the thing is a() is a function and map is a tuple...having an unusable/unused function in a tuple could explain that output
+ 1
@DefaltSimon Thanks, but what I mean is what <map=0Ă010AB510> is?
Can anyone tell me plz?
0
The reason this is happening is because you need to iterate over the list.
A simple list(map(a, nums)) should also work.
0
add list()