December 27 2006

  Today I reviewed the articles on Python and Ruby.  Python and Ruby both are script and both are popular.
About three years ago, I went over them.  I remembered I wrote a small game in Python language.  I found
that the Ruby language doesn't seem to have not some features, such as high order functor, make a lambda
express, and so forth.  In my eyes, Ruby just is a script edition of C++ or Java although it have provide
lots of and convenient APIs.  The author of Ruby was a C++ programmer at once.  So, he copied OOP features
from C++ into his script.

  When reading a chm file, its name is "Dive Into Python", I found that Python language has those features
which Ruby just is scarce.  For example, there is a map example in Python.

>>> li = [1, 9, 8, 4]
>>> [elem*2 for elem in li]     
[2, 18, 16, 8]

  It is same to the following scheme codes.

(map (lambda (x) (* x 2)) '(1 9 8 4))

  In Python, you can write a lambda express.
>>> g = lambda x: x*2 
>>> g(3)
6
>>> (lambda x: x*2)(3)
6

  Even you can return a lambda express by using "yield".  Python also built in hash table, list as its data
types.  In some ways, you can simulate some features of scheme in Python.  Python also has OOP features,
such as class, inheritance, and so on.

  The APIs supplied by Python is alike system calls of POSIX.  I suspect that the author of Python just wrapped
them in Python. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值