问题:Google大量使用Python [关闭]

Google对Python的大量使用,仅仅是口味问题还是它给他们带来了竞争优势?

Google’s heavy usage of Python, is it just a matter of taste or does it give them a competitive advantage?


回答 0

我真的不能给出确切的答案,因为当我2004年在Google进行采访时,Python在Google方面已经很突出。

确实,有一个显然吸引人的解释,我绝对可以否认:不是Google使用Python是因为它雇用了这么多杰出的Pythonista使用者-而是,大多数“杰出的Pythonista” Google员工至少部分地加入了Google,因为我们知道Python的重要性在那里(可能有Peter Norvig和Jeremy Hyltonexceptions,但从历史上看,谷歌对Python的选择甚至早于它们)。

这绝对是我首先感兴趣的原因(我的出版商让我知道了Google正在购买的大量书籍-起初,我认为这是出售我的自由咨询服务的好机会…;- ),后来我如何说服Guido加入我们,而且,我相信,这是诸如Greg Stein,Wesley Chun,Fredrik Lundh,Thomas Wouters,Collin Winters,Jeffrey Yasskin等Pythonista的动机的一部分。

我相信,这一切都是开始的,因为最早的Google员工(Sergey,Larry,Craig等)做出了一个很好的工程决策:“ Python在我们可以的地方,C ++在我们必须的地方” –他们使用了(一部分) C ++用于软件堆栈中对延迟非常低和/或对内存的严格控制至关重要的部分,而对于其他部分,Python允许更快速地交付和维护程序。上世纪90年代后期,后一种角色的选择基本上在Python和Perl之间:其他脚本语言要么未成熟(例如,我认为Ruby还不存在),要么存在其他问题和局限性。Perl更加成熟(特别是在通过CPAN提供的可用附件生态系统方面),但是Python被认为具有更高的可读性和可维护性,并且与C ++库的接口(通过SWIG)更加容易。

Java后来出现了,涵盖了一个中间市场-当然,Go是最近开发的(尽管我不相信其中有很多生产工作,因为它还在不断发展和成熟)。一些特殊的语言(例如sawzall)也可以用于非常具体的任务,当然Javascript对于浏览器端的工作非常重要。

其他语言,包括格雷格(Greg)在’06提到的语言,都是“偶然的”或用于其他特定任务(例如,针对iPhone或Macs上的客户端的Objective C),例如,当Google雇用其第一批系统管理员时,这些员工不可避免地精通Perl和Bash,并经常使用这两种语言来开发一些复杂的内部系统。用Python重新编码(为了更易于部署和维护)经常发生。其他人(例如C#)可能由于收购而暂时陷入混乱,但是同样,使用“一种主要的Google语言”进行重新编码始终是相当高的优先级(在C#的情况下,重新编码通常主要是使用Java,因为两种语言在抽象层次上都涉及相似的领域)。

I can’t really give a definitive answer, because by the time I interviewed at Google in 2004 Python was already prominent at Google.

Indeed, there’s one apparently attractive explanation that I can definitely deny: it’s not that Google uses Python because it employs so many prominent Pythonistas — rather, most “prominent Pythonista” googlers joined Google, at least in part, because we knew about Python’s prominence there (possible exceptions include Peter Norvig and Jeremy Hylton, but historically Google’s choice of Python predated even them).

That’s definitely why I first got interested (my publisher let me know about the large amount of copies of my book that Google was purchasing — at first, I thought of it as a good opportunity to sell my freelance consulting service…;-), how I was later able to convince Guido to join us, and, I believe, part of the motivation for such Pythonistas as Greg Stein, Wesley Chun, Fredrik Lundh, Thomas Wouters, Collin Winters, Jeffrey Yasskin, …

It all got started, I believe, because the very earliest Googlers (Sergey, Larry, Craig, …) made a good engineering decision: “Python where we can, C++ where we must” — they used (a subset of) C++ for the parts of the software stack where very low latency and/or tight control of memory were crucial, and Python, allowing more rapid delivery and maintenance of programs, for other parts. At the time, late ’90s, the choice for the latter role was essentially between Python and Perl: other scripting languages were either unripe (I don’t think Ruby was around yet, for example) or had other issues and limitations. Perl was more mature (especially in terms of its ecosystem of available add-ons via CPAN), but Python was deemed to be more readable and maintainable, and interfacing to C++ libraries (via SWIG) was easier.

Java came in later, covering an intermediate niche — and more recently of course Go was developed (though I don’t believe there’s much production work in it yet, as it’s still evolving and maturing). Some specialized languages such as sawzall are also in the mix for very specific tasks, and of course Javascript is very important for browser-side work.

Other languages, including the ones that Greg mentioned back in ’06, are either “kind of accidental” or used for other specific tasks (e.g., Objective C for clients on iPhones or Macs) — e.g., when Google hired its first system administrators, those employees inevitably came with very strong mastery of Perl and Bash, and often used either of those languages to develop some complex internal system; recoding those in Python (for easier deployment and maintainability) has often happened. Others (such as C#) may have been in the mix temporarily due to acquisitions, but, again, recoding in one of the “main Google languages” is always a pretty high priority (in C#’s case, recoding would typically be mostly in Java, as the two languages address similar areas in terms of levels of abstraction).


回答 1

我尚未阅读整篇文章,也不知道它的代表性,但这也许可以回答您的问题:Google的Python

好的,我阅读了大部分内容,不幸的是,它并没有提供太多的见解,但我认为它仍然是一篇有趣的文章。也许最重要:

在Google中,Python是C ++和Java以及3种“官方语言”之一。这里的正式表示允许Google员工将这些语言部署到生产服务中。(内部Google员工使用许多技术,包括PHP,C#,Ruby和Perl)。Python非常适合Google的工程流程。Google的典型项目只有一个小团队(3人),工期短(3个月)。


别忘了Python的创建者Guido van Rossum从2005年至2012年在Google工作;)


我也找到了这个报价,但我无法验证它:

“ Python从一开始就一直是Google的重要组成部分,并且随着系统的发展和发展而一直存在。如今,数十名Google工程师使用Python,我们正在寻找更多使用这种语言的人。”
-Peter Norvig, Google搜索质量总监

I have not read the whole article and I don’t know how representative it is but maybe this answers your question: Python at Google.

Ok I read most of it, unfortunately it gives not that much insight but I think it is still an interesting article. Maybe most important:

At Google, python is one of the 3 “official languages” alongside with C++ and Java. Official here means that Googlers are allowed to deploy these languages to production services. (Internally Google people use many technologies including PHP, C#, Ruby and Perl). Python is well suited to the engineering process at Google. The typical project at Google has a small team (3 people) and a short duration (3 months).


Not to forget that Guido van Rossum the creator of Python worked for Google from 2005-2012 ;)


I also found this quote but I cannot verify it:

“Python has been an important part of Google since the beginning, and remains so as the system grows and evolved. Today dozens of Google engineers use Python, and we’re looking for more people with skills in this language”
— Peter Norvig, Director of Search Quality at Google


回答 2

我在阅读有关Unladen-Swallow的项目,该项目旨在提高CPython的性能。在浏览过他们的讨论板上我偶然发现了这个讨论,其中科林冬季(谷歌员工和Python核心开发者)的回答要求谷歌员工正在从使用Python为新项目气馁

好吧,简单的常识将限制Python在Google规模上运行时的适用性:它不如Java或C ++快,线程糟糕,内存使用率更高等。在设计任何新系统时,我们面临的设计约束之一是, “当负载增加10倍或100倍时会发生什么?如果整个星球都认为您的新服务很棒,会发生什么?” 任何技术,使满足该约束更难-我认为Python属于这一类- 应该如果没有以其他优点支持它的理由不充分,则不要灰心。您必须在Python的优点和缺点之间取得平衡:您的工程师使用Python可能会提高生产力,但是如果随着数量的增加他们不得不解决更多平台级的性能/扩展限制,您会领先吗?等等

I was reading about Unladen-Swallow, a project that aims to improve the performance of CPython. While browsing through their discussion board I stumbled across this discussion, where Collin Winter (Google employee and Python core developer) answers on the claim that Google employees are being discouraged from using Python for new projects:

Well, simple common sense is going to limit Python’s applicability when operating at Google’s scale: it’s not as fast as Java or C++, threading sucks, memory usage is higher, etc. One of the design constraints we face when designing any new system is, “what happens when the load goes up by 10x or 100x? What happens if the whole planet thinks your new service is awesome?” Any technology that makes satisfying that constraint harder — and I think Python falls into this category — should be discouraged if it doesn’t have a very strong case made in its favor on other merits. You have to balance Python’s strengths with its weaknesses: your engineers may be more productive using Python, but if they have to work around more platform-level performance/scaling limitations as volume increases, do you come out ahead? etc.


回答 3

如果您赞同Paul Graham的简洁== power 想法(即,如果我可以用10行的语言用X语言编写代码来完成您用100行的Y语言所编写的代码,那么我的语言会更强大)

这些天硬件便宜,肉制品昂贵。我知道与其他语言相比,我可以用Python写出更多,更快,更好和更清晰的文字,仅是因为往往包括电池在内。当然,它可能会慢一些,但是您真的会注意到.05秒和.0005秒之间的区别吗?

在一个更真实的示例中,如果Google开发人员使用Python编写程序而不必担心垃圾收集,而X公司使用C ++编写程序,并且他们花费了10%的时间来查找与内存分配相关的错误,猜猜谁做得更快-即使C ++商店设法以同样快的速度编写其余代码。

所以是的,我想说用Python编写代码具有竞争优势。

If you subscribe to Paul Graham’s idea that succinctness == power (i.e. If I can write code in language X in 10 lines to accomplish what you took 100 lines of language Y, my language is more powerful)

These days hardware is cheap, meatware is expensive. I know that I can write a lot more, faster, better AND clearer in Python than I can in other languages, simply because the batteries tend to be included. Sure, it may be slower but are you really going to notice the difference between .05 seconds and .0005 seconds?

In a more real-world example, if Google developers write a program in Python where they never have to worry about garbage collection, and Company X writes a program in C++ and they spend 10% of their time tracking down bugs related to memory allocation, guess who’s done faster – even if the C++ shop manages to write the rest of their code just as fast.

So yes, I’d say it is a competitive advantage to code in Python.


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。