<分区>
我对使用 Python 进行函数式编程很感兴趣,并且正在研究 Mary Rose Cook 的博客文章 A practical introduction to functional programming .
显然,它是用 python 2 编写的:
name_lengths = map(len, ["Mary", "Isla", "Sam"])
print name_lengths
# => [4, 4, 3]
在 Python 3 中产生这个:
<map object at 0x100b87a20>
我有两个问题:
- 为什么会这样?
- converting the map object to a list and then use numpy 除外,还有其他解决办法吗?