在路上...

导航

 

本来做一个勤勤恳恳的码农我应该学习佩雷尔曼前辈的作风 --- "佩雷尔曼反复说他已经退出了数学界,不再认为自己是职业数学家了。"

不过鉴于Gtalk跳出很多朋友 -- 写PHP的和写Java的 -- 很高兴的告诉我伟大的CSDN上出现了一条新闻:
[独家]Google将限制Python语言的应用 开发社区热议 http://news.csdn.net/a/20091116/214803.html

加上很多菜鸟们无知的写到"看得心都碎了。"

我这颗不甘寂寞的心久久不能平静。

还是写一点东西吧。

不过,先做一个广告,我在卖python空间 http://stdyun.com/vhost

11月11号开始小规模出售,目前已经卖出11个,预定几个,距离一台机器卖50个目标还很遥远,不过距离卖出30个新增另一个机房第二台服务器已经很接近了:)

鉴于CSDN编辑翻译的非常非常非常糟糕 -- 断章取义,词不及义,加上不懂Python。

大家还是先去看看原帖 http://groups.google.com/group/unladen-swallow/browse_thread/thread/4edbc406f544643e

原帖在Unladen Swallow的论坛上。Unladen Swallow是Python的一个分支,由Google的一组开发人员组成。

我来翻译一小段:

kgn
I'm told that Google employees are being discouraged from using Python for new projects,
which seems silly given how much Python code and Python support comes out of Google.
I've hunted for more information but haven't found any.
Do you know any details, or is this just a rumor?

我听说Google不鼓励员工在新项目中用Python。
Google把如此多是Python代码和Python支持挪走听起来很傻。
我想再八卦一下,可惜没找到什么爆料。
你了解更多细节吗,又或者只是谣传。

        
Collin Winter      

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.

恩,显而易见,一些缺陷将限制Google在做大规模时使用Python:

    没Java或是C++那么快,糟糕的线程,高的内存占用,等等。

我们开始设计任何一个新系统时,我们需要面对的问题是:

    当负载增加了10倍或者100倍系统会怎样?

    当全世界都赞叹你的新应用令人难忘时会怎么样?

在这样有高难度的挑战面前,什么技术都很难让人满意 -- 并且,我认为Python也是属于这类 -- 如果没有什么特别的应用场景,在其他方面使其将功赎罪的话,"应该"不被鼓励使用。

你需要权衡Python的优缺点:
    
    你的工程师用Python生产力会更高。

    但是,随着压力膨胀,当你不得不去面对更多平台级别的性能/可扩展性时,你能领先(问题)一步吗?
   
    等等

--------------------------------------------------------------------

点评:

到此为止,大家可以看到,其实这两人就是在随便扯扯 -- 大意就是,Python不是万能,一切都是要权衡的  -- 与那标题党的标题基本没有什么关系 。

这简直就是废话 -- 从来没有一个 Pythoner 认为 Python 是万能的 -- Python是我们伟大的胶水 -- 倒是有很多Cpper和Javaer认为自己的神是万能的。

--------------------------------------------------------------------

接着看下面的邮件,CSDN的编辑不懂Python,没搞懂Cython是什么,把它和CPython混淆了。

CPython是python的官方解释器。

Cython是用类似Python语法,给Python写C扩展的方式。

    Cython is a language that makes writing C extensions for the Python language as easy as Python itself. Cython is based on the well-known Pyrex, but supports more cutting edge functionality and optimizations.

    Cython是一种语言,让用C给Python写扩展和写Python一样容易。Cython从广为人知的Pyrex的基础上发展起来,但有更多的转换函数和优化。


事实上,Python+Cython是一种很爽的组合方式,如同 Tom Machinski  所说

"""
Specifically, if an engineer wishes to pursue a performance-intensive
project in Python, why not tell him to use Cython (or Python with some
C extensions) rather than force him to a completely different language
like Java or C++.

An engineer who picks Python as his first choice is probably familiar
enough with the language to utilize Cython / C-extension effectively,
and would probably rather do that than use any of those completely
different languages. As a bonus, Google gets a tool that's probably
easier to maintain than your common C++ codebase.

确切地说,如果一个工程师希望在Python的项目中追求性能,为什么不告诉他如何使用Cython(或蟒蛇和一些C扩展),而不是强迫他一个完全不同的语言:如Java或C + +。
  
一个Pythoner的程序员,不难熟悉运用Cython / C扩展来追求效率。而且这样做或许会比用其他完全不同的语言更合适。

同时,Google也能得到一个比C++代码库更容易维护工具。
"""

当然,一般而言,普通代码用Cython优化没什么明显效果,用它封装一些瓶颈的函数就可以了 -- 更多时候是用来把C库变成Python的库 。

=====================================

好吧,大家就不要扯淡了。

庄子逍遥游有云:

    且夫水之积也不厚,则其负大舟也无力。
    
    覆杯水于坳堂之上,则芥为之舟;
    
    置杯焉则胶,水浅而舟大也。
    
    风之积也不厚,则其负大翼也无力。
    
    故九万里则风斯在下矣,
    
    而后乃今培风;背负青天而莫之夭阏者,而后乃今将图南。

有资格去设计这么大应用的时候再去指手画脚吧,Python写网站抗个日PV几KW还是很小case的。

Google怎么做,只是用来吹牛的聊资罢了,何况Python之父还在Google呢。

现在 -- 该干嘛干嘛去。

再批判一下CSDN,当年误导我钻研C++ Template,浪费了一年半载的光阴。

唉,我又浪费青春在口水战中了。。。

posted on 2009-11-17 15:26  AK747  阅读(2455)  评论(7编辑  收藏  举报