大数跨境
0
0

Guido van Rossum 谈 Python 如何使代码思考变得更容易

Guido van Rossum 谈 Python 如何使代码思考变得更容易 蟒营
2019-11-30
0

The Mind at Work: Guido van Rossum on how Python makes thinking in code easier 

工作思路:Guido van Rossum 谈 Python 如何使代码思考变得更容易

By Anthony Wing Kosner

Published on November 25, 2019


A conversation with the creator of the world’s most popular programming language on removing brain friction for better work.
[与世界上最流行的编程语言的创建者进行的对话,旨在消除大脑摩擦,从而改善工作。]
Nothing defines the 21st century more than the ubiquitous effects of computer programming. Almost everything we do, particularly at work, is mediated by screens displaying the results of the enormous amount of computation that we now take for granted. If you’re one of the 99.7% of the human race that are not programmers, how all of this happens is a bit of a mystery. As science fiction writer Arthur C. Clarke quotably wrote, “Any sufficiently advanced technology is indistinguishable from magic.”
[对21世纪的定义,无非是计算机编程无处不在的影响。屏幕几乎显示了我们所做的一切,尤其是在工作中所做的一切,这些屏幕显示了我们现在认为理所当然的大量计算结果。如果您是不是程序员的人类中99.7%的人之一,那么所有这些事情如何发生是一个谜。正如科幻小说家亚瑟·克拉克(Arthur C. Clarke)引述的那样:“任何足够先进的技术都无法与魔术区分开。” ]
Of course, it isn’t magic. It is, however, both complicated and complex, with codebases of tech companies measured in millions of lines of code. When you’re reasoning about a real system you might want to build in code, you’re thinking about the complex relationships between different functions over time. Your code can be more or less complicated in how it is written and structured, but the problem you're trying to solve has an inherent complexity that can’t be reduced to something simpler.
[当然,这不是魔术。但是,它复杂且复杂,高科技公司的代码库以数百万行代码衡量。当您在考虑一个真实的系统时,您可能想在代码中进行构建,这是在考虑一段时间内不同功能之间的复杂关系。您的代码在编写和结构上可能或多或少复杂,但是您要解决的问题具有固有的复杂性,无法将其简化为简单的东西。]
Becoming a programmer is not just about ideas, and you won’t last long at it if you can’t deal with the laser-focused details of describing your ideas in code. “I'm a little skeptical of the claim that the systems thinking is primary there, because it's much easier to come up with an idea for a system than it is to take an idea and turn it into working code,” says Guido van Rossum, the creator and retired BDFL (Benevolent Dictator for Life) of the Python programming language. JavaScript still owns the web, and Java runs 2.5 billion Android phones, but for general purpose programming and education, Python has become the default standard.
[成为一名程序员不仅仅与想法有关,而且如果您无法处理在代码中描述想法的激光细节,您将不会长久坚持下去。Guido van Rossum说:“我有点怀疑系统思想是那里的主要思想,因为提出一个系统构想比将一个构想转化为工作代码要容易得多。” ,是Python编程语言的创建者和退休的BDFL(生命慈善独裁者)。JavaScript仍然拥有网络,Java运行着25亿部Android手机,但是对于通用编程和教育来说,Python已成为默认标准。]
If anyone has made turning an idea into working code easier, for more people, it’s Van Rossum over his 30-year history with Python. And he’s done it with a self-effacing grace and an understated humor—the language is named after the surreal comedy of Monty Python, not the actual Burmese python. In its quiet way, the Python programming language has managed to make some of the complications of programming computers less difficult for our brains to manage.
[如果有任何人更容易将想法转换为可工作的代码,那么对于更多人来说,这就是范·罗苏姆(Van Rossum)拥有30多年的Python工作经验。而且他以谦逊的风度和低调的幽默来做到这一点-该语言以Monty Python的超现实喜剧而不是真正的缅甸python命名。Python编程语言以一种安静的方式设法使编程计算机的一些复杂性变得我们的大脑难以管理。]
To understand how Van Rossum accomplished this amazing feat, we have to go back into the history of computing to the era of mainframes and machine language. “The mainframe is a machine that costs many millions of dollars, and the combined pay of all those programmers is peanuts compared to the cost of the mainframe,” he says, explaining that cost logically prioritized machine time over human time. “But as I experienced desktop workstations and PCs, I realized that a change of mindset about cost of the programmer's time versus cost of the computer's time was overdue.” Van Rossum doesn’t think he was the first person to observe this shift, but he really capitalized on it in the design of Python.
[要了解Van Rossum如何完成这一惊人的壮举,我们必须回到计算的历史到大型机和机器语言的时代。他说:“大型机是一台花费数百万美元的机器,与大型机的成本相比,所有这些程序员的薪水都是小菜一碟。”他解释说,从逻辑上讲,这种成本优先于机器时间,而不是人工。“但是当我体验台式工作站和PC时,我意识到对程序员时间成本与计算机时间成本的观念转变已经过时了。” Van Rossum认为他不是第一个观察到这种转变的人,但是他在Python的设计中真正利用了它。]
This simple idea of giving humans priority over machines is at the core of the philosophy behind Python. Certainly the fact that it’s an interpreted language as opposed to a compiled language means that the programmer gets immediate feedback about the code they’re writing without needing to take the time to recompile it after making each change. This is very common now, but thirty years ago it was quite controversial because the conventional wisdom was that faster (for the computer) was better. Updating this belief has had a large positive impact on the productivity of programmers.
[这种赋予人类高于机器优先级的简单想法是Python背后哲学的核心。当然,它是一种解释性语言,而不是一种编译语言,这意味着程序员可以立即获得有关所编写代码的反馈,而无需在每次更改后都花时间重新编译它。现在这很普遍,但是三十年前这引起了很大争议,因为传统观点认为(对于计算机)速度越快越好。更新这一信念对程序员的生产力产生了很大的积极影响。 ]
“In Python, every symbol you type is essential.” —Guido van Rossum “There are a whole bunch of common programming tasks that are easy in Python,” says Van Rossum. “For someone who is not yet a programmer, who wants to become a programmer, for those people Python is particularly easy to get.” Indeed, many computer science schools are switching over from Java to Python, because it’s much easier to grasp for beginners. The reasons behind this are complex, with many factors each reducing little bits of friction. What’s simple is the philosophy behind all of the improvements: Everything should have a necessary purpose. The lack of extraneous code makes it easier to focus on what you need to pay attention to. “In Python, every symbol you type is essential,” Van Rossum says.
[“在Python中,您键入的每个符号都是必不可少的。” —Guido van Rossum“在Python中,有很多常见的编程任务很容易。” Van Rossum说, “对于那些尚未成为程序员的人来说,想要成为一名程序员,对于这些人来说,Python特别容易获得。”的确,许多计算机科学学院正在从Java切换到Python,因为对于初学者而言,它更容易掌握。。其背后的原因很复杂,有许多因素都可以减少摩擦。简单来说就是所有改进背后的理念:一切都应该有必要的目的。由于没有多余的代码,因此可以更轻松地专注于需要注意的地方。“在Python中,您键入的每个符号都是必不可少的,” Van Rossum说。]
This concision makes it easy to accomplish something meaningful in Python, which is one of the reasons for its wide adoption. “The typical way that we introduce Python to beginning programmers is also important. We can show them very small snippets of code that require very little understanding of terminology and concepts from programming before they make sense,” Van Rossum explains, “whereas the smallest Java program, for example, contains a whole bunch of what are, to the uninitiated eye, noise characters.”
[这种简洁使得在Python中轻松完成有意义的事情成为了它被广泛采用的原因之一。“我们向初学者引入Python的典型方式也很重要。Van Rossum解释说,“我们可以向他们展示很小的代码片段,而这些片段仅需要很少的编程知识和编程概念的理解就可以了,例如,最小的Java程序,包含了一大堆杂乱字符。”]
This quietness and simplicity of design makes it easier to see what’s going on. “Python for me is incredibly visual,” says Van Rossum. “When I read Python, I definitely see it as a two-dimensional structure, rather than one-dimensional, like language. That is probably because Python uses indentation for grouping, but probably also because my mind just likes thinking visually.”
[这种安静,简单的设计使查看情况变得更加容易。“对我而言,Python的视觉效果令人难以置信,” Van Rossum说。“当我阅读Python时,我肯定将其视为一种二维结构,而不是像语言一样的一维结构。这可能是因为Python使用缩进进行分组,也可能是因为我的想法只是喜欢直观地思考。”]
He’s not the only one, of course, who thinks visually. We all do to some extent. But he’s particularly sensitive to the effects of the visual on cognition. “Some poorly formatted text can drive me crazy. They interrupt my visual parsing of the flow and the structure, and in that sense, I do think in Python,” Van Rossum admits. “I can grasp code much better when it's formatted properly.” It takes more information to resolve the uncertainty about what code indentations mean if they’re arbitrary than if those indentations have a clear purpose, as they do in Python. So if the experience is easier, it’s because fewer bits of information have to be processed for you to know what’s going on.
[当然,他并不是唯一一个在视觉上思考的人。我们都在某种程度上做到了。但是他对视觉对认知的影响特别敏感。“某些格式较差的文本会让我发疯。它们打乱了我对流程和结构的视觉解析,从这个意义上讲,我确实认为是用Python编写的。” Van Rossum承认。“如果格式正确,我可以更好地掌握代码。”与缩进具有明确的目的相比,这需要更多的信息来解决代码缩进意味着什么的不确定性,就像在Python中那样。因此,如果使用起来比较容易,那是因为只需处理较少的信息,您就可以知道发生了什么。]
Python’s readability is not just typographic, but conceptual. Van Rossum thinks Python may be closer to our visual understanding of the structures that we are representing in code than other languages because, “Python makes that structure mandatory.”
[Python的可读性不仅是印刷的,而且是概念上的。Van Rossum认为Python可能比其他语言更接近我们对我们在代码中表示的结构的视觉理解,因为“ Python使该结构成为强制性。”]
"While I was researching my book, CODERS,” says author Clive Thompson, “I talked to a lot of developers who absolutely love Python. Nearly all said something like ‘Python is beautiful.’ They loved its readability—they found that it was far easier to glance at Python code and see its intent. Shorn of curly brackets, indented in elegant visual shelves, anything written in Python really looks like modern poetry." They also find that Python is fun to write, which is more important than it may seem. As Thompson writes, “When you meet a coder, you’re meeting someone whose core daily experience is of unending failure and grinding frustration.”
[作者克莱夫·汤普森(Clive Thompson)说:“我在研究我的书《 CODERS》时,我与很多绝对喜欢Python的开发人员进行了交谈。几乎所有人都说'Python很漂亮。'他们喜欢它的可读性-他们发现它是 用Python编写的任何东西看起来都像是现代诗歌。” 他们还发现Python写起来很有趣,这比看起来更重要。正如汤普森(Thompson)所说:“遇到编码员时,您遇到的是一个每天的核心经验是无休止的失败和沮丧的人。”]
“You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer.” —Guido van Rossum Building the priority of the programmer’s time into the language has had a curious effect on the community that’s grown around it. There’s a social philosophy that flows out of Python in terms of the programmer’s responsibility to write programs for other people. There’s an implicit suggestion, very much supported by Van Rossum in the ways he talks and writes about Python, to take a little more time in order to make your code more interpretable to someone else in the future. Expressing your respect for others and their time through the quality of your work is an ethos that Van Rossum has stealthily propagated in the world. “You primarily write your code to communicate with other coders, and, to a lesser extent, to impose your will on the computer,” he says.
[“您主要是为了与其他编码员交流而编写代码,并且在较小程度上将您的意愿强加于计算机上。” —Guido van Rossum将程序员的时间优先用于该语言对社区产生了奇怪的影响 在它周围成长。就程序员负责为其他人编写程序而言,有一种社会哲学从Python衍生而出。有一个隐含的建议,Van Rossum在他谈论和撰写Python的方式上得到了很多支持,这需要花费更多的时间,以便将来使您的代码对其他人更易解释。通过工作质量表达对他人及其时间的尊重是范·罗瑟姆(Van Rossum)在世界范围内秘密传播的一种精神。他说:“您最初编写代码是为了与其他编码人员进行交流,并且在较小程度上将您的意志强加于计算机上。”]
The universality of the culture that’s spread around Python has achieved some measure of what Van Rossum intended two decades ago with a short-lived project called CP4E (Computer Programming for Everybody). “I'm usually not a very visionary thinker. People always ask me, what's next for Python, and I never know. But I put on my most visionary hat, and assumed that it would make sense for everyone to learn programming.” Personal computers had been around for 20 years, but mostly they were glorified typewriters and calculators. Van Rossum asked, “isn't it crazy that all those people have computers, and very few of them learn to program?”
[围绕Python传播的这种文化的普遍性已经达到了Van Rossum两年前的意图,即一个名为CP4E(每个人的计算机编程)的短期项目。“我通常不是一个非常有远见的思想家。人们总是问我,Python的下一步是什么,我永远也不知道。但是我戴上了最有远见的帽子,并认为对每个人来说学习编程都是有道理的。”个人计算机已经存在了20年,但大多数时候它们都是美化的打字机和计算器。范·罗瑟姆(Van Rossum)问:“所有人都拥有计算机,而且很少有人学会编程是不是很疯狂?”]
In the time since, he has focused on making programming easier to learn and easier to do through the advancements in Python, now at version 3.7. He still thinks that programming teaches generally valuable skills, like problem solving, following directions carefully, and understanding what directions mean. But he’s also found that, “there are certain introductions to programming that are fun for kids to do, but they're not fun for all kids, and I don't think I would want to make it a mandatory part of the curriculum.”
[从那时起,他一直致力于通过现在3.7版的Python的改进使编程更易于学习和实现。他仍然认为编程通常会教授一些有价值的技能,例如解决问题,认真遵循指示以及理解指示的含义。但是他还发现,“有一些编程入门对孩子们来说很有趣,但是对所有孩子都不是很有趣,而且我认为我不想将其作为课程的强制性部分。”]
At the same time, the need for people to program their computers has also diminished because of the growth of software, particularly on the web, that allows you to intuitively do what used to require programing to accomplish. “I'm not so sure that it needs to happen anymore,” Van Rossum says of CP4E. “I think computers have made it to that point, where they're just a useful thing that not everybody needs to know what goes on inside.”
[同时,由于软件的增长(尤其是在网络上)的增长,人们对计算机进行编程的需求也有所减少,这使您可以直观地完成编程所需的工作。“我不太确定它是否需要再发生,” Van Rossum在谈到CP4E时说道。“我认为计算机已经做到了这一点,它们只是一种有用的东西,并不是每个人都需要知道内部发生了什么。”]
“Python is now also the language of amateurs, and I mean that in the best possible way.” —Guido van Rossum But that are a growing number of people who are using Python in many fields. “The currently prevailing theory about Python's unexpected success,” says Van Rossum, “is that at some point, it established itself into data science and machine learning, and scientific data processing in general, and once you have critical mass, it's easier for everyone to use the same system as their colleagues and their competitors, than to try something different.” And even though it started as purely a tool for professional programmers, Van Rossum says, “Python is now also the language of amateurs, and I mean that in the best possible way.”
[“ Python现在也是业余爱好者的语言,我的意思是尽可能地做到这一点。” ——Guido van Rossum但是越来越多的人在许多领域使用Python。Van Rossum说:“关于Python意外成功的当前流行理论是,在某个时候,它已经确立了自己在数据科学和机器学习以及一般科学数据处理中的地位,一旦达到临界水平,每个人都会更容易 可以使用与同事和竞争对手相同的系统,而不是尝试不同的东西。”尽管它起初纯粹是专业程序员的工具,但Van Rossum说:“ Python现在也是业余爱好者的语言,我的意思是 以最好的方式。”]
A successful open source software project, like Python, has to be easy to learn for beginners, but also have practical application to real world problems that more advanced users will want to solve. Just as for beginners you want to keep things simple so all of their brain energy is spent on learning the complications of the programming environment, for advanced users you want to help them manage the complexity of these competing abstractions. Part of the motivation for making the implementation of Python as simple as possible is to be able to change your mind, to learn, to iterate. “If you write a prototype in Python and you get it to work, often, that’s not a very big effort,” says Van Rossum, “and then you can afford to throw away your prototype and write the same thing again based on what you've learned. You can still write it in Python, but the second version will be much better than the first.”
[一个成功的开源软件项目(如Python)对于初学者来说必须易于学习,而且还必须在实际应用中应用到更高级的用户想要解决的现实问题上。就像对于初学者一样,您想使事情保持简单,以便他们的所有脑力都花在学习编程环境的复杂性上;对于高级用户,您希望帮助他们管理这些竞争性抽象的复杂性。使Python的实现尽可能简单的动机的一部分,是能够改变主意,学习和迭代。Van Rossum表示:“如果您使用Python编写原型并能正常工作,那并不是什么大事,然后您就可以舍弃原型并根据自己的想法再次编写相同的东西。已经学到了。您仍然可以用Python编写它,但是第二个版本将比第一个版本好得多。”]
Part of the enduring appeal of Python is the optimism and humility of starting over. “If you've invested much more time into writing and debugging code, you're much less eager to throw it all away and start over.” Co-founder and CEO, Drew Houston wrote the first prototype of Dropbox in Python on a five-hour bus ride from Boston to New York. “The early prototypes of Dropbox were thrown away, largely, many times,” says Van Rossum.
[Python持久的吸引力之一就是重新开始的乐观和谦逊。“如果您在编写和调试代码上投入了更多的时间,那么您就不急于将其全部扔掉并重新开始。”联合创始人兼首席执行官Drew Houston用五种语言在Python中编写了Dropbox的第一个原型。从波士顿到纽约的半小时巴士车程。Van Rossum说:“ Dropbox的早期原型被大量抛弃了。”]
What can we learn from Python about how to design better tools for thinking? Tim Peters, one of Python’s major contributors, offers some clues in the aphoristic The Zen of Python, in which he channels Van Rossum’s guiding principles. Particularly relevant to our present discussion are this pair: “Simple is better than complex. Complex is better than complicated.” This could almost be a recipe for how the brain prioritizes its functions to use energy efficiently.
[我们可以从Python中学到什么有关如何设计更好的思维工具?Python的主要撰稿人之一蒂姆·彼得斯(Tim Peters)提供了一些警句“ Python之禅”的一些线索,他在其中介绍了范·罗瑟姆(Van Rossum)的指导原则。这对与我们当前的讨论特别相关:“简单胜于复杂,复杂总比繁杂要好。“这几乎可以成为大脑如何优先考虑其功能以有效利用能量的秘诀。]
Equally important for Van Rossum is the social aspect of thinking and building tools. What has he taken away from his thirty year journey with Python? “I have learned that you can't do it alone, which is not an easy lesson for me. I've learned that you don't always get the outcome that you went for, but maybe the outcome you get is just as good, or better.”
[对于Van Rossum而言,思考和构建工具的社会方面同样重要。在使用Python的30年中,他带走了什么?“我了解到您不能独自做到这一点,这对我而言并非易事。我了解到,您并非总能得到想要的结果,但是也许您得到的结果是一样的,甚至更好。”]
 简单说:
Python之禅 真的包含了老爹 所有关键思考成果.


建立与更多 Python 学习者的联接 , 及时获取最新课程动态 
欢迎你关注蟒营 ~
【声明】内容源于网络
0
0
蟒营
人生编程陪伴/你本来就很行;-)原创私塾式课程:大数据分析+爬虫+可视化/人工智能/深度学习/机械视觉/写作/作曲/...只要坚持几周任何新技能获得都将不是问题.
内容 64
粉丝 0
蟒营 人生编程陪伴/你本来就很行;-)原创私塾式课程:大数据分析+爬虫+可视化/人工智能/深度学习/机械视觉/写作/作曲/...只要坚持几周任何新技能获得都将不是问题.
总阅读10
粉丝0
内容64