PHP與Python的比較 (PHP vs Python)

來源:互聯網
上載者:User



在這裡,我節錄了一些關於PHP和Python比較的文章和討論,讓我們能從另外一個 角度來看待PHP的優點和缺點。
同樣作為一種指令碼語言,底層同樣是由C語言來開發的,Python是OO的,現在PHP也OO了。Python是多用途的(可用於案頭應用和web應用),PHP是專長於web應用的。當PHP還在苦惱如何整合進去大程式時,Python早就可與Java,。NET相連了。。。。

    * Python的可讀性,可維護性比PHP好;
    * PHP的發展存在一個向後相容性的問題,Python不存在;
    * PHP的入門門檻底,Python比較高(其實Python語言是挺簡單的,難在要有OO的思想,PHP在OO化後,面臨同樣的問題);
    * 到目前為止,支援PHP的伺服器多,支援Python的少 (隨著硬體成本的降低,估計狀況很快會改變)。


曾經有人說過,PHP的底層架構不適合用OO,那Python為什麼OO用的那麼好?
曾經有人說過,PHP用OO速度慢,那用Python的人,為什麼並不覺得慢?

PHP用OO個人覺得是件好事,但看過Python以後,感覺PHP現在實現OO的功能與方法比Python還多,是好還是壞?作為一種指令碼語言是否能很好的承載得起呢?

感覺PHP有點像當年的C++,既要面向OO,又要相容C,搞得倍複雜。而Python有點像當年的Java,從開始就是面向OO的,並立足於指令碼語言,對OO的功能與方法作了相當的簡化,做自己力所能做的事情。

PHP以簡單易學而名,現在為了企業化應用,如果搞得像C++一樣既要顧及相容性,又幾乎全盤copy Java的OO功能,難免會變得複雜,之後會不會被其他語言所代替呢?

他山之石,可以攻玉。我們是否應該學習一下Python,從中得到一些啟發呢?

現在當大家都一致看好PHP時,結合種種跡紹,我似乎感到了背後的一絲寒風,。。。希望只是己人憂天。

從PHP發展的角度,為今之計,我想最好的辦法,就是大力普及推廣PHP在中國的應用,先佔領市場再說,因此寫了個建議 (串連),可惜看來也是胎死腹中了。。。

==========================================================================
第一部分:介紹Python
What is Python?

(PYTHON的中文解釋 :http://www.okpython.com/bbs/thread-73-1-1.html)

Python is a programming language that is freely available and that makes solving a computer problem almost as easy as writing out one''s thoughts about the solution. It can be written once and run on almost any computer without needing to change the program. In this section, you can learn more about what Python is, how it is used, and how it compares to other programming languages. Use the menu below to browse the various sections of this article.
Python was first created by Guido von Rossum in 1990 and was named after the Brit-com Monty Python''s Flying Circus. It has since been developed by a large team of volunteers and is freely available from the Python Software Foundation. The most recent version of Python, 2.5, was released in September, 2006.

Python is now found in many incarnations. At the website of the Python Software Foundation, Python is written in C. Other incarnations exist. A Java-based version of Python exists in Jython and may be used to work with Java c

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.