Python vs. Lisp - 请解释一下 [英] Python vs. Lisp -- please explain

查看:82
本文介绍了Python vs. Lisp - 请解释一下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在想Python和Lisp。在过去的几个月里,我一直在学习

Python,非常喜欢它。几年前,我有一个人工智能课,我们不得不使用Lisp,我绝对讨厌它,几年前学过C ++的b $ b。他们根本没有教过Lisp,而是希望我们自己学习。我不知道我必须将我的思维过程连根拔起获得。它结束了感觉就好像是一个美元。


在学习Python时,我已经阅读了更多关于Lisp的内容,而不是我实际上的内容

试图学习它,似乎两种语言有很多相似之处:

http://www.norvig.com/python-lisp.html


我我想知道是否有人可以向我解释一下它是什么意思

Python与Lisp如此不同以至于无法将其编译成

编译Lisp?从上面这个网站和其他人的b $ b $我已经知道编译好的Lisp几乎和C / C ++一样快,

所以我不明白为什么是Python最终还不能有效吗?

是否存在一些具体的*基本原因很难?或者这个问题一般来说这个问题很难解决,而且Lisp与Python相比已经有40多年了?

~15岁?

谢谢

Michael

Hi, I''ve been thinking about Python vs. Lisp. I''ve been learning
Python the past few months and like it very much. A few years ago I
had an AI class where we had to use Lisp, and I absolutely hated it,
having learned C++ a few years prior. They didn''t teach Lisp at all
and instead expected us to learn on our own. I wasn''t aware I had to
uproot my thought process to "get" it and wound up feeling like a
moron.

In learning Python I''ve read more about Lisp than when I was actually
trying to learn it, and it seems that the two languages have lots of
similarities:

http://www.norvig.com/python-lisp.html

I''m wondering if someone can explain to me please what it is about
Python that is so different from Lisp that it can''t be compiled into
something as fast as compiled Lisp? From this above website and
others, I''ve learned that compiled Lisp can be nearly as fast as C/C++,
so I don''t understand why Python can''t also eventually be as efficient?
Is there some *specific* basic reason it''s tough? Or is it that this
type of problem in general is tough, and Lisp has 40+ years vs Python''s
~15 years?
Thanks
Michael

推荐答案

63 ******* @ sneakemail.com 写道:
几年前我有一个AI课程,我们有使用Lisp,我非常讨厌它,几年前学过C ++。他们根本没有教过Lisp,而是希望我们自己学习。


我认为CS课程没有改变。

在学习Python时,我读到了更多关于Lisp的内容,而不是我实际上的内容。 >试图学习它,似乎这两种语言有很多相似之处:

http://www.norvig.com/python-lisp.html

我想知道是否有人可以向我解释请问它与Lisp如此不同的Python是不是可以编译成像编译Lisp一样快的东西?从上面这个网站和其他人那里,我已经知道编译好的Lisp几乎和C / C ++一样快,所以我不明白为什么Python最终也不能像有效吗?
是否有一些特定的*基本原因很难?或者说这种问题一般都很困难,Lisp与Python相比还有40多年的时间〜15年?
A few years ago I
had an AI class where we had to use Lisp, and I absolutely hated it,
having learned C++ a few years prior. They didn''t teach Lisp at all
and instead expected us to learn on our own.
CS classes haven''t changed, I see.
In learning Python I''ve read more about Lisp than when I was actually
trying to learn it, and it seems that the two languages have lots of
similarities:

http://www.norvig.com/python-lisp.html

I''m wondering if someone can explain to me please what it is about
Python that is so different from Lisp that it can''t be compiled into
something as fast as compiled Lisp? From this above website and
others, I''ve learned that compiled Lisp can be nearly as fast as C/C++,
so I don''t understand why Python can''t also eventually be as efficient?
Is there some *specific* basic reason it''s tough? Or is it that this
type of problem in general is tough, and Lisp has 40+ years vs Python''s
~15 years?




这是设计的。 Python是动态类型的。它本质上是一个解释脚本语言,如javascript或ruby或perl,虽然

python粉丝会很快告诉你python被编译为字节码。

他们也会很快告诉你:

-python有真正的闭包(虽然没有像ruby'的块)

-is初学友好(尽管区分大小写并且3/4 == 0,例如)

- 实际上并不慢(尽管有基准,因为你注意到显示

否则)。

为自己判断。


有些项目结合了静态类型+ python语法,这大大地带来了
更快的代码,但可能只有80%的python'的
功能和动态类型的灵活性较低。

像shedskin这样的项目。但是有些蟒蛇粉丝并不认为80%会削减它,即使你的速度提高了100倍,也不会有b $ b。



It is by design. Python is dynamically typed. It is essentially an
interpreted scripting language like javascript or ruby or perl, although
python fans will be quick to tell you python is compiled to byte code.
They''ll also be quick to tell you:
-python has true closures (although nothing like ruby''s blocks)
-is beginner friendly (despite being case sensitive and 3/4==0, for example)
-is not, in fact, slow at all (despite benchmarks as you noted showing
otherwise).
Judge for yourself.

There are projects that combine static typing + the python syntax, which
result in dramatically faster code, but perhaps only 80% of python''s
functionality and less flexibility you get from dynamic typing.
Projects like shedskin. But some python fans don''t think 80% cuts it,
even if you do get a 100 fold speed increase.




< 63 ******* @ sneakemail.com>在消息中写道

news:11 ********************** @ z14g2000cwz.googlegr oups.com ...

<63*******@sneakemail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
在学习Python时,我已经阅读了更多关于Lisp的内容,而不是在我实际学习它的时候,看起来这两种语言有很多相似之处:

http://www.norvig.com/python-lisp.html

我想知道是否有人可以向我解释一下它是什么关于它与Lisp如此不同的Python它不能被编译成

为了这么快,一些解释Lisp的动力必须是放弃的
。特别是目标代码不是列表数据。消除了
类型 - 动态消除的Python也可以转换为体面的C / C ++,然后编译为
。参见PyRex和Weave。还有Psyco,我相信

会直接翻译成机器代码。

所以我不明白为什么Python最终也不能有效率?
是否存在一些具体的*基本原因,这很难?或者说这种问题一般都很困难,Lisp与Python相比还有40多年的时间〜15年?
In learning Python I''ve read more about Lisp than when I was actually
trying to learn it, and it seems that the two languages have lots of
similarities:

http://www.norvig.com/python-lisp.html

I''m wondering if someone can explain to me please what it is about
Python that is so different from Lisp that it can''t be compiled into
something as fast as compiled Lisp? From this above website and
others, I''ve learned that compiled Lisp can be nearly as fast as C/C++,
In order to be that fast, some of the dynamism of intepreted Lisp must be
given up. In particular object code is not list data. Python with
type-dynamism eliminated can also be translated to decent C/C++ and then
compiled. See PyRex and Weave. There is also Psyco, which I believe
translates directly to machine code.
so I don''t understand why Python can''t also eventually be as efficient?
Is there some *specific* basic reason it''s tough? Or is it that this
type of problem in general is tough, and Lisp has 40+ years vs Python''s
~15 years?




是的,*很多*更多的工作已经进入Lisp而不是Python。 (至少10倍,我肯定是b $ b肯定。也许高达100倍)在20世纪80年代,有一个类似dot.com的Lisp / AI

繁荣/萧条上世纪90年代的繁荣/萧条与

或许投资于Lisp / AI公司的10亿美元。我假设其中一些

进入Lisp本身(而不是AI应用程序)。


Terry Jan Reedy



Yes, *much* more work has gone into Lisp than Python. (At least 10x, I am
sure. and maybe up to 100x) During the 1980s, there was a Lisp/AI
boom/bust something like the dot.com boom/bust of the last 1990s with
perhaps a billion invested in Lisp/AI companies. I presume some of that
went into Lisp itself (as opposed to AI applications thereof).

Terry Jan Reedy



63 ******* @ sneakemail.com 写道:

63*******@sneakemail.com wrote:

我想知道是否有人可以向我解释一下它是什么意思
Python与Lisp如此不同以至于它可以'不像编译的Lisp那样编译成
的东西吗?从上面这个网站和其他人那里,我已经知道编译好的Lisp几乎和C / C ++一样快,所以我不明白为什么Python最终也不能像有效吗?
是否有一些特定的*基本原因很难?或者这种问题一般都很难,而且Lisp比Python已经超过40年了〜15年?

I''m wondering if someone can explain to me please what it is about
Python that is so different from Lisp that it can''t be compiled into
something as fast as compiled Lisp? From this above website and
others, I''ve learned that compiled Lisp can be nearly as fast as C/C++,
so I don''t understand why Python can''t also eventually be as efficient?
Is there some *specific* basic reason it''s tough? Or is it that this
type of problem in general is tough, and Lisp has 40+ years vs Python''s
~15 years?




我不确定它会回答问题,但Brett cannon的论文很好

背景

http://www.ocf.berkeley.edu/~bac/thesis.pdf



i''m not sure it''ll answer question, but Brett cannon''s thesis is good
background

http://www.ocf.berkeley.edu/~bac/thesis.pdf


这篇关于Python vs. Lisp - 请解释一下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆