【发布时间】:2017-08-14 16:25:51
【问题描述】:
我对使用 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,还有其他解决方案吗?
【问题讨论】:
标签: python python-3.x python-2.7 functional-programming