TE||Computer programming
1
导读
请将屏幕横过来
感谢小兔提供的思维导图
小兔,女,外企打工仔,设技爱好者
2
听力|精读|翻译|词组
Computer programming
电脑编程
英文部分选自经济学人Science and technology版块
Computer programming
电脑编程
And now for something completely different
创新时代
Python, a simple and versatile computing language, has brought coding to a vast new audience
简洁、用途广泛的程序设计语言Python, 把万千新用户带进编程世界
IN DECEMBER 1989 Guido van Rossum, a Dutch computer scientist, set himself a Christmas project. Irked by shortcomings in other programming languages, he wanted to build his own. His principles were simple. First, it should be easy to read. Rather than sprawling over line-endings and being broken up by a tangle of curly braces, each chunk would be surrounded with indented white space. Second, it should let users create their own packages of special-purpose coding modules, which could then be made available to others to form the basis of new programs. Third, he wanted a “short, unique and slightly mysterious” name. He therefore called it after Monty Python, a British comedy group. The package repository became known as the Cheese Shop.
1989年12月,荷兰计算机科学家吉多·范·罗森 (Guido van Rossum)制定了一个圣诞节计划。由于厌倦了其他编程语言的缺陷,他想设计一套自己的编程语言。他的理念很简单:第一,易读。每个数据块不再是一大串一直写到行尾,被大括号打断的代码,而是被缩进的空白符包围;第二,用户可以创建自己的专用编码模块包,其他人也可以在这些模块包的基础上开发新程序;第三,他想要一个“简短,独特,带点神秘色彩”的名字。因此,他用英国喜剧团体巨蟒剧团(Monty Python)的名字命名该编程语言,数据包库则取名为“奶酪店(cheese shop)”。
Nearly 30 years after his Christmas invention, Mr Van Rossum resembles a technological version of the Monty Python character who accidentally became the Messiah in the film “Life of Brian”. “I certainly didn’t set out to create a language that was intended for mass consumption,” he explains. But in the past 12 months Google users in America have searched for Python more often than for Kim Kardashian, a reality-TV star. The rate of queries has trebled since 2010, while inquiries after other programming languages have been flat or declining (see chart).
Python诞生30年之后,范·罗森(Van Rossum)在技术界,就像Monty Python在电影《布莱恩的一生》(Life of brian)中扮演的角色那样,意外地成了救世主。他解释道,“我没想过要创造一种用于大众消费的语言”。但在过去的12个月内,美国Google用户搜索Python的频率,比搜索真人秀明星金· 卡戴珊(Kim Kardashian)的频率还要高。2010年以来,其查询率增长了两倍,而其他编程语言的查询率则一直持平或者下降(见图表)。
The language’s popularity has grown not merely among professional developers—nearly 40% of whom use it, with a further 25% wishing to do so, according to Stack Overflow, a programming forum—but also with ordinary folk. Codecademy, a website that has taught 45m novices how to use various languages, says that by far the biggest increase in demand is from those wishing to learn Python. It is thus bringing coding to the fingertips of those once baffled by the subject. Pythonistas, as aficionados are known, have helped by adding more than 145,000 packages to the Cheese Shop, covering everything from astronomy to game development.
编程论坛Stack Overflow的数据显示,这一计算机语言不仅受到专业程序员的欢迎—约有40%的专业人士使用Python,另外还有25%的人表达了使用意愿—而且还有普通人使用Python。网站编码学院(Codecademy)已经教会4500万名初学者如何使用各种程序语言,该网站表示,到目前为止学习Python语言的用户需求量增长最大。因为,Python让那些对编程望而却步的人学会了写代码。Python的拥趸们(Pythonistas)在奶酪店(数据包库里)添加的数据包超过了145000个,内容涵盖了从天文学到游戏开发的方方面面。
Mr Van Rossum, though delighted by this enthusiasm for his software, has come to find the rigours of supervising it, in his role as “benevolent dictator for life”, unbearable. He fears he has become something of an idol. “I’m uncomfortable with that fame,” he says, sounding uncannily like Brian trying to drive away the crowds of disciples. “Sometimes I feel like everything I say or do is seen as a very powerful force.” On July 12th he resigned, leaving the Pythonistas to manage themselves.
用户的狂热让范·罗森感到高兴,但他也发现自己作为“善意的独裁者”,肩负严峻的监管责任,这令他感到难以承受。他担心自己会成为偶像人物。“名声大噪令我感觉不自在”他说道,这听起来就像布莱恩试图赶走众多门徒一样特立独行。“有时我觉得无论我说什么,做什么都被当做圣旨。”7月12日他辞职离开,留下Python拥趸们进行自我管理。
Nobody expects the faddish statistician
此处翻译不确定,欢迎大家踊跃留言
Python is not perfect. Other languages have more processing efficiency and specialised capabilities. C and C++ are “lower-level” options which give the user more control over what is happening within a computer’s processor. Java is popular for building large, complex applications. JavaScript is the language of choice for applications accessed via a web browser. Countless others have evolved for various purposes. But Python’s killer features—simple syntax that makes its code easy to learn and share, and its huge array of third-party packages—make it a good general-purpose language. Its versatility is shown by its range of users and uses. The Central Intelligence Agency has employed it for hacking, Pixar for producing films, Google for crawling web pages and Spotify for recommending songs.
Python并不完美。其他语言具有更高的处理效率和专业能力。C和C ++是“较低级别”选项,使用户更好地控制计算机处理器中运行的程序。Java在构建大型复杂应用程序方面颇为常用。JavaScript是通过Web浏览器访问应用程序的首选语言。还有无数其他语言根据各种不同的目的发展演化。但Python的杀手级功能——语法简单,代码易于学习和共享,且第三方软件包极其庞大——使其成为一种优秀的通用语言。广泛的用户和用途也体现出该语言运用的多样性。中央情报局将其用于黑客攻击,Pixar用它制作电影,谷歌用它抓取网页,Spotify用它推荐歌曲。
Some of the most alluring packages that Pythonistas can find in the Cheese Shop harness artificial intelligence (AI). Users can create neural networks, which mimic the connections in a brain, to pick out patterns in large quantities of data. Mr Van Rossum says that Python has become the language of choice for AI researchers, who have produced numerous packages for it.
Python拥趸们可以在奶酪店中找到一些最具诱惑力的AI包。 用户可以创建神经网络,模仿大脑中的连接,从而在大量数据中找出相关模式。范·罗森表示,Python已成为人工智能研究人员的首选语言,他们已经为此制作了大量软件包。
Not all Pythonistas are so ambitious, though. Zach Sims, Codecademy’s boss, believes many visitors to his website are attempting to acquire skills that could help them in what are conventionally seen as “non-technical” jobs. Marketers, for instance, can use the language to build statistical models that measure the effectiveness of campaigns. College lecturers can check whether they are distributing grades properly. (Even journalists on The Economist, scraping the web for data, generally use programs written in Python to do so.)
然而,不是所有的Python 拥趸们都如此雄心勃勃。编程学院网站的老板扎克·西姆斯(Zach Sims)认为,该网站上的许多访问者都试图获得一些技能从而帮助他们从事传统意义上的 “非技术”性的工作。例如,营销人员可以使用该语言,建立统计模型,测算营销活动的有效性。大学讲师可以检查自己是否给学生正确评分。(即使是“经济学人”的记者,通常也会使用Python编写的程序在网上搜索数据。)
For professions that have long relied on trawling through spreadsheets, Python is especially valuable. Citigroup, an American bank, has introduced a crash course in Python for its trainee analysts. A jobs website, eFinancialCareers, reports a near-fourfold increase in listings mentioning Python between the first quarters of 2015 and 2018.
对于长期依赖通过电子表格来查阅信息的专业人士来说,Python也是特别有价值的。美国花旗银行已经给实习分析师引入Python的速成课了。求职网站eFinancialCareers报告称,从2015年第一季度到2018年,提及Python的公司增加了近四倍。
The thirst for these skills is not without risk. Cesar Brea, a partner at Bain & Company, a consultancy, warns that the scariest thing in his trade is “someone who has learned a tool but doesn’t know what is going on under the hood”. Without proper oversight, a novice playing with AI libraries could reach dodgy conclusions. Bernd Ziegler, a partner at Boston Consulting Group, says that his firm reserves such analysis to members of its data team.
对这些技能的渴求总与风险相伴。贝恩咨询公司(Bain&Company)的合伙人塞萨尔·布雷亚(Cesar Brea)提醒道,他经历的交易中最可怕的事情是“人们学会了一种工具,却不知道后台到底发生了什么”。 如果没有适当的监督,那些玩AI库的新手可能会得出危险的结论。 波士顿咨询集团(Boston Consulting Group)的合伙人贝恩德·齐格勒 (Bernd Ziegler)表示,他的公司只会向其数据团队的成员保留此类分析。
Rossum’s universal robot
罗素姆万能机器人
注释:1921年捷克剧作家卡尔.恰佩克(KarlCapek)在名为《罗素姆万能机器人》(Rossums Universal Robot)的戏剧作品中创造了“robot”(机器人)这个名词。这个词源于捷克语的“robota”,意思是“苦力”。在该剧的结尾,机器人接管了地球,并毁灭了它们的创造者。
One solution to the problem of semi-educated tinkerers is to educate them properly in the language’s arcana. Python was already the most popular introductory language at American universities in 2014, but the teaching of it is generally limited to those studying science, technology, engineering and mathematics. A more radical proposal is to catch ’em young by offering computer science to all, and in primary schools. Hadi Partovi, the boss of Code.org, a charity, notes that 40% of American schools now offer such lessons, up from 10% in 2013. Around two-thirds of 10- to 12-year-olds have an account on Code.org’s website. Perhaps unnerved by a future filled with automated jobs, 90% of American parents want their children to study computer science.
一种解决方法就是教半吊子的学习者正确理解Python语言的奥秘。2014年,Python就已经是美国大学里最受欢迎的入门语言,但是学习者大多都局限于有着理学,工学,工程师和数学背景的学生。更彻底的方法则是从娃娃抓起,在所有小学里普及计算机课。慈善机构Code.org的总裁哈迪·帕托维(Hadi Patrovi)指出,现在40%的美国学校都提供相关课程, 高于2013年的10%。美国约有三分之二的10到12岁的孩子有code.org的账户。或许是担心未来的工作都与自动化有关,90%的美国家长都想让他们的孩子学习计算机科学。
How much longer Python’s rise will continue is anybody’s guess. There have been dominant computer languages in the past that, while not exactly “one with Nineveh and Tyre”, now skulk in the background. In the 1960s, Fortran bestrode the world. As teaching languages for neophytes, both Basic and Pascal had their moments in the sun. And Mr Partovi himself plumped for JavaScript as the language for Code.org’s core syllabus, since it remains the standard choice for animating web pages.
大家都在猜测Python还能火多久。曾经也有一些计算机语言红极一时,现在虽不至于变成昨日黄花,但也已经慢慢淡出。在20世纪60年代,Fortran汇编语言风靡世界。至于新手教材语言,Basic和Pascal也都有他们如日中天的时候。帕托维自己仍把JavaScript选作Code.org的核心课程。因为它仍是制作动画网页们的标杆语言。
注释:one with Nineveh and Tyre,出自Rudyard Kiplin的诗集Recessional。原文如下:“Lo, all our pomp of yesterday Is one with Nineveh and Tyre!”大意指一切盛况都会变成过眼烟云。Nineveh、Tyre均为古城名。
No computing language can ever be truly general purpose. Specialisation will necessarily remain important. It is nevertheless true that, in that long-past Yuletide, Mr Van Rossum started something memorable. He isn’t the Messiah, but he was a very clever boy.
没有哪种计算机语言可以真正通用于所有领域。专业细分依然十分重要。然而,在那个圣诞节期间,范·罗森确实着手干了件值得纪念的大事。他不是救世主,但他的确是一个非常聪明的人。
注释:Messiah 弥赛亚,圣经中犹太民族的拯救者。可指救星、救世主。
翻译组:
Frank,男,小硕,经济学人爱好者
Xingyi,男,小硕,经济学人爱好者
Helga,女,笔译民工,经济学人爱好者
Vambie,女,互联网民工,经济学人粉丝
校核组:
Li Xia, 女, HR, 经济学人发烧友
Yifei:女,英专硕士,专八,catti二笔
3
观点|评论|思考
本次观点由Joel独家奉献
Joel,男,数据分析,科技类外刊爱好者
世界上主流的编程语言有很多种,我觉得Python是最人性化的,阅读一个良好的Python程序就感觉像是在读英语一样。它使你能够专注于解决问题而不是去搞明白语言本身。
编程语言是人类写给编译器看的,编译器编译后“傻不拉几”的计算机才能读懂人类要表达的意思(计算机只能读懂0和1),在目前主流的编程语言中,Python是最接近自然语言的,省掉繁杂的标点符号,简洁明了。另外Python也是一种胶水语言,它能够很轻松的把用其他语言制作的各种模块(尤其是C/C++)轻松地联结在一起,方便高效。
最后我用Python之禅的前半部分结束简短的感想:
优美胜于丑陋,
明了胜于晦涩。
简洁胜于复杂,
复杂胜于凌乱。
扁平胜于嵌套,
稀疏胜于密繁。
可读性很重要!
The Zen of Python
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
4
愿景
小组
现有一经济学人大群,如果您也有兴趣,可联系小编WeChat : foxwulihua。