我感興趣的是使用python進行函數式編程,並且正在通過Mary Rose Cook的博客帖子A practical introduction to functional programming。在python 3中解決映射函數問題vs python 2
顯然,它是用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之外,還有其他解決方案嗎?