python 里map()函数想到的外国人为什么要这么定义函数

来源:互联网 发布:如何用vb编写上位机 编辑:程序博客网 时间:2024/05/16 15:19

首先 map(function,iterable,..)

iterable 一个或多个序列

举个例子

>>map(square,[1,2,3,4,5])# 计算列表和:1+2+3+4+5

[1,4,9,16,25]

1)如果这个函数是中国人来定义的话至少应该是map(iterable,function)

比较符合我们的逻辑如:x^2,但外语的语法习惯都是 xxx of sth ,所以跟我们的习惯是反着的,

2)然后我的印象里map的意思是地图(英语太渣),

然后查了下 Oxford Advanced Learner's Dictionary,里面map做动词有个用法 map sth on/onto sth 解释为 to link a group of qualities,items,etc. with their source,cause,position on a case.

综上我们就知道了为什么map()函数这样定义了,所以多多学英语 (#^.^#)




阅读全文
1 0