为什么我喜欢python。 [英] Why I love python.

查看:100
本文介绍了为什么我喜欢python。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

保罗·格雷厄姆有一篇关于蟒蛇的精彩文章,甚至还有一篇关于它的更好的讨论。我之所以指出这一点,是因为我阅读这两篇文章的次数越多,我就会越多地意识到我们将如何使用上帝被遗弃的@ decorator来破坏语言。 br />
我不知道你们其他人,但是我学习了python并且因为它的语法和简单而爱上了b $ b。 Python - 只是工作。所以请

GVR。不要复杂化。保持原样。努力让它更快,

不是更丑陋。工作 - 在某些情况下 - 更好的算法用于某些

模块,而不是它甚至非常类似于C或perl或者上帝知道

无论其他语言还有什么。我是唯一一个对这件事情有什么内心反应的人吗?


保罗格雷厄姆文章: http://www.paulgraham.com/pypar.html


Slashdot讨论:
http://developers.slashdot.org/devel...id=156&tid=218

解决方案

"迈克尔斯嘉丽" <双******* @ yahoo.com>在消息中写道

news:ce ************************** @ posting.google.c om ...

保罗·格雷厄姆有一篇关于蟒蛇的精彩文章,甚至还有关于它的更好的讨论。我之所以指出这一点,是因为我读的这两篇文章越多,就越能意识到我们将如何用那个神弃绝的@ decorator来破坏语言。
我不是了解你们其他人,但我学习了python并且对它的语法和简洁感到满意。 Python - 只是工作。所以请
GVR。不要复杂化。保持原样。努力让它变得更快,不是更丑陋。工作 - 在某些情况下 - 更好的算法用于某些模块,而不是它甚至非常类似于C或perl或者上帝知道
无论其他语言在哪里。我是唯一对这件事有内心反应的人吗?




不,我有同样的反应。


Michael Scarlett写道:

我不知道你们其他人,但是我学习了python并且对它的语法和简洁感到满意。


这对Python来说很有趣。这真的不简单,但确实好像是b $ b。关于范围界定,有很多小的琐碎规则,

继承,以及你有什么 - 但你可以幸福地无知

他们中的大多数仍然可以工作完成。这是非常独特的。


我认为这就是为什么人们如此关注@pie:它有

*潜力*是学习过程早期的一个障碍,而不是在某个人已经被吸引之后的b $ b。

我是唯一一个对此事有内心反应的人???



天哪,不!为什么你认为我们一直在撒尿和呻吟这么多?


- Mark


2004-08 -13,Michael Scarlett< bi ******* @ yahoo.com>写道:

保罗·格雷厄姆有一篇关于蟒蛇的精彩文章,甚至还有关于它在slashdot上的更好的讨论。


是的,文章非常好

不要复杂化。保持原样。努力让它变得更快,而不是更丑。




如果要废弃

,Python需要大幅提升性能脚本语言柱头。获得这些改进的唯一方法是使用一个python实现来生成*高效*

*编译*代码。同时,

语言的动态类型特性是其最有价值的特征之一。在尝试编写一个体面的python

编译器时,这是最困难的一个问题。如果您定义如下函数:


def sum(a,b):

返回+ b


编译器如何知道要生成的代码?它可以跟踪sum()的所有

应用程序,并确定sum()是什么类型的参数
实际应用的
。但这并不容易,有时它是直接无法实现的。


不同的方法是程序员*建议*什么

函数将*最有可能*应用于的类型。

程序员可能会向编译器建议a。和b将*最多

可能是整数或浮点数,因此编译器必须为处理这些情况的函数生成

代码(或代码为两个

" functions" ;,每种情况一个)。有人可能会说这个功能可能会被装饰。由程序员关于其

参数的类型。请注意,在这种情况下,装饰不会以任何方式改变函数的行为!该函数仍可以使用字符串参数调用
,在这种情况下,执行将被分派到解释中。它的版本。


所以我相信是让它更快需要一些基本的工作,而不是简单地为某些

模块设计更好的算法。对于某些模块而言,更好的算法会给你带来一些东西,比如点性能改善。能够生成

高效的编译代码,可以让你在
10和一个数量级之间进行改进(取决于
$ b的类型) $ b计划)。对于使其更安全也是如此。 (例如,通过

为程序员提供一种方式来指定哪些类型的参数

*允许*传递给函数)。


一般来说,python必须摆脱它的perl-ish青春期

(小东西的语言,不一定非常快或非常$ / $
安全),但不会失去灵活性。装饰者可能是朝着正确方向迈出的一步,或者至少他们可能允许进行一些实验

这样的事情。


因此,我们欢迎他们。


只是我的2c

/ npat


There is an amazing article by paul graham about python, and an even
better discussion about it on slashdot. The reason I point this out,
is the more I read both articles, the more I realised how we would be
mutilating the language with that god forsaken @ decorator.
I don''t know about the rest of you, but I learned python and fell in
love with its syntax and simplicity. Python - just works. So please
GVR. Don''t complicate it. Leave it as is. Work on making it faster,
not uglier. Work on - in some cases - better algorithms for certain
modules, not for it to even closely resemble C or perl or god knows
whateverotherlanguagethereisoutthere. Am i the only one with a
visceral reaction to this thing???

paul Graham article: http://www.paulgraham.com/pypar.html

Slashdot discussion:
http://developers.slashdot.org/devel...id=156&tid=218

解决方案

"Michael Scarlett" <bi*******@yahoo.com> wrote in message
news:ce**************************@posting.google.c om...

There is an amazing article by paul graham about python, and an even
better discussion about it on slashdot. The reason I point this out,
is the more I read both articles, the more I realised how we would be
mutilating the language with that god forsaken @ decorator.
I don''t know about the rest of you, but I learned python and fell in
love with its syntax and simplicity. Python - just works. So please
GVR. Don''t complicate it. Leave it as is. Work on making it faster,
not uglier. Work on - in some cases - better algorithms for certain
modules, not for it to even closely resemble C or perl or god knows
whateverotherlanguagethereisoutthere. Am i the only one with a
visceral reaction to this thing???



Nope I have the same reaction.


Michael Scarlett wrote:

I don''t know about the rest of you, but I learned python and fell in
love with its syntax and simplicity.
That''s the funny thing about Python. It really isn''t simple, but it sure
seems like it is. There''s tons of little niggling rules about scoping,
inheritance, and what have you--but you can be blissfully ignorant of
most of them and still get work done. That''s pretty unique.

I think that''s why people are so concerned about @pie: it has the
*potential* to be an obstacle early in the learning process, instead of
after someone is already hooked.
Am i the only one with a visceral reaction to this thing???



Goodness, no! Why do you think we''ve all been pissing and moaning so much?

-- Mark


On 2004-08-13, Michael Scarlett <bi*******@yahoo.com> wrote:

There is an amazing article by paul graham about python, and an even
better discussion about it on slashdot.
Yes, the article is very good
Don''t complicate it. Leave it as is. Work on making it faster, not
uglier.



Python needs drastic performance improvement if it is to scrap-off the
"scripting language" stigma. The only way to get these improvements is
making it possible for a python implementation to produce *efficient*
*compiled* code. At the same time the dynamic-typing nature of the
language is one of its most valuable characteristics. And this is one
of the hardest problems when trying to write a decent python
compiler. If you define a function like:

def sum (a, b):
return a + b

How can the compiler know what code to produce? It could trace all the
applications of sum(), and decide what types of arguments sum() is
actually applied on. But this is not easy, and sometimes it is
straight-out impossible.

A different approach would be for the programmer to *suggest* what
kind of types the function will *most probably* be applied on. The
programmer might suggest to the compiler that "a" and "b" will *most
probably* be integers or floats, so the compiler will have to produce
code for a function that handles these cases (or code for two
"functions", one for each case). One might say that the function could
be "decorated" by the programmer regarding the type of its
arguments. Notice that in such a case the decoration does not alter
the behavior of the function in any way! The function can still be
called with string arguments, in which case execution will be
dispatched to an "interpreted" version thereof.

So I believe is that "making it faster" requires some fundamental
work, and not simply devising "better algorithms for some
modules". Better algorithms for some modules will give you something
like point-something improvement in performance. Being able to produce
efficient compiled code will give you improvement between a factor of
10 and an order of magnitude (depending on the type of the
program). The same it true for "making it more secure" (e.g by
providing the programmer a way to specify what types of arguments are
*allowed* to be passed to a function).

In general, python must break free from its perl-ish adolescence
(language for small things, which doesn''t have to be very fast or very
safe), but without loosing its agility. Decorators might be a step in
the right direction, or at least they might allow some experimentation
with such matters.

Because of this they are welcome.

Just my 2c
/npat


这篇关于为什么我喜欢python。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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