Python、Lua和Ruby比较——脚本语言大P.K.
生活随笔
收集整理的這篇文章主要介紹了
Python、Lua和Ruby比较——脚本语言大P.K.
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
譯者按:Python、lua和ruby在C/C++是日漸式微的情況下,在java/.net的圍殲中努力抗爭的三個當紅小生。在Tom Gutschmidt的著作《Game Programmng with Python, Lua and Ruby》一書中,介紹了三種語言在游戲中的應用,其中尤為了不起的是在書中最后一章中比較了三種腳本,作者沒有說孰優孰劣,但是讀者你認為呢?歡迎留言討論。
本文最初發表于戀花蝶的博客http://blog.csdn.net/lanphaday,歡迎轉載,但敬請保持全文完整。
Python versus Lua Versus Ruby
Python、Lua和Ruby——腳本大P.K.
Tom Gutschmidt?著
賴勇浩(http://blog.csdn.net/lanphaday)?譯
So which of the three languages is the best to use on your project? That depends a great deal on what you want to accomplish. To wrap up the book, I've outlined some of the pros and cons of each language in this section.
這三種語言中的哪一種更合適你的項目?很大程度取決于你想達到什么樣的目標。作為一書的結尾,在這一節里,我會描述一下它們各自的優點和不足。
Python Pros and Cons
Python的優點和不足
The pros of Python are as follows:
Python的優點如下:
·?????????Python has more extension modules than the other languages.
·?????????Python比其它語言有更多擴展模塊。
·?????????Many online Python tutorials exist. There are also plenty of English books and reference materials, many sample scripts exist online, and there is a wealth of introductory material. The Python.org Website is a good place to start looking for these because it has sections for beginners, tutorials, guides organized by topic, and lists of links and references.
·?????????在網上可以找到很多Python教程。不僅如此,還有大量的英文書籍和資料。Python.org有很多為初學者準備的依主題組織的資料、教程和編程指南,此外還有很多鏈接和參考。
·?????????Most folks really enjoy the syntax of the Python language because it appears clean and is easy to read.
·?????????很多人都喜歡Python語言的語法,因為它清晰易讀。
·?????????Python has an edge where libraries are concerned. There are many libraries, and, for the most part, they are well documented.
·?????????Python在支持庫上大占優勢,因為它有很多庫,而且大部分都有完善的文檔支持。
·?????????Lots of tools that tie into Python are available, and they are often easier to find than the tools for Lua and Ruby.
·?????????很多工具可以用于Python,但難以找到適用于Lua和Ruby的。
The cons of Python are as follows:
Python的不足:
·?????????Existing Python debuggers are considered quirky and slow. Debugging support on Macintosh and consoles is even weaker.
·?????????現有的Python調試器詭異而且效率低下。在Macintosh(蘋果計算機)和控制臺下進行調試是一個夢魘。
·?????????It can be difficult to bundle Python with other languages. There are lots of binary DLLs, and Python has (compared to the other languages) a large standard distribution.
·?????????Python難以與其它語言集成,它有太多的二進制DLL,而且Python帶了巨大的標準發布包。
·?????????Lots of folks really dislike the white space sensitivity of Python syntax.
·?????????同樣的,也有很多人不喜歡Python對空白符敏感的語法。
·?????????Python can be quite slow at times, as everything is an object on the heap.
·?????????因為堆上的任何東西都是對象,所以Python有時候會慢得難以忍受。
Lua Pros and Cons
Lua的優點和不足
The pros of Lua are as follows:
Lua的優點:
·?????????Lua is probably the fastest of the three languages and usually uses the least amount of runtime memory.
·?????????Lua在這三種語言中是運行時速度最快而且占內在最少的。
·?????????Lau has the smallest memory footprint for bundling.
·?????????集成Lua只會增加極少的內存占用率。
·?????????The Lau C API is very well documented and has good examples for integrating with C.
·?????????Lua的C API有著完備著文檔和很好的例子,可以容易地通過C集成在軟件里。
The cons of Lua are as follows:
Lua的不足:
·?????????The documentation has improved but is still a bit sketchy overall. Of the three languages, Lua it is probably the least documented (the API being the exception), with the least amount of code comments. This makes for the largest ramp-up time to learn, and there isn't much in the way of introductory Lua material.
·?????????盡管Lua的文檔已經增進不少,但仍然有所不足。三種語言中,Lua可能是文檔最少的(API方面是個例外),因為代碼中極少注釋,這也增加了學習的難度。另外,對Lua的本質也沒有什么介紹。
·?????????There isn't a lot of built-in functionality for Lua. There is little support if you need to create a large, complex application.
·?????????Lua內建的功能很少,并沒有對創建大型的復雜應用程序提供足夠支持。
·?????????Lua could use a better garbage collectorthe current development is moving towards that now. Right now, Lua GC uses a very simple and traditional simple mark and sweep.
·?????????Lua應該使用更好的垃圾收集機制,Lua現在的GC仍然使用非常簡單而且傳統的“標記和清除”方式。
Pros and Cons of Ruby
Ruby的優點和不足
The pros of Ruby are as follows:
Ruby的優點:
·?????????Ruby possesses fairly good advanced debuggers.
·?????????Ruby有極好的高級調試器。
·?????????Ruby is object oriented from the ground up, and programmers who are OOP enthusiasts or who are used to the OOP paradigm will find the language extremely comfortable.
·?????????Ruby是最徹底的面向對象語言,對于OOP狂熱者和慣于使用OOP范式的程序員,他們將會發現Ruby是最適合他們的語言。
·?????????Ruby has arguably the simplest syntax, with no real rules exceptions. Especially true for OOP enthusiasts.
·?????????Ruby的語法極為簡單,沒有讓人出乎意料規則,特別適合OOP行家的習慣。
The cons of Ruby are as follows:
Ruby的不足:
·?????????Lack of English documentation.
·?????????英文文檔極度缺乏。
·?????????Fewer existing works and samples for games than with the other languages.
·?????????與其它語言相比,在游戲方面所作的工作和實例都少得多。
總結
以上是生活随笔為你收集整理的Python、Lua和Ruby比较——脚本语言大P.K.的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python温故
- 下一篇: Python 字符串方法详解