Python悖论

Paul Graham 2004-08-01

Python悖论

2004年8月

在最近的一次演讲中,我说了一些让很多人不高兴的话:你可以让更聪明的程序员在Python项目上工作,而不是在Java项目上工作。

我这样说并不是指Java程序员很笨。我的意思是Python程序员很聪明。学习一门新的编程语言需要很多工作。人们学习Python并不是因为它能给他们带来工作;他们学习它是因为他们真正喜欢编程,并且对已经知道的语言不满意。

这使他们成为公司应该想要雇佣的那种程序员。因此,由于缺乏更好的名称,我称之为Python悖论:如果一个公司选择用相对冷门的语言编写其软件,他们将能够雇佣到更好的程序员,因为他们只会吸引那些足够关心它而去学习它的人。而对于程序员来说,这个悖论更加明显:如果你想找到一份好工作,应该学习的语言是那些人们不仅仅是为了找工作而学习的语言。

到目前为止,只有少数公司足够聪明地意识到了这一点。但这里也有一种选择在进行:它们正是程序员最想为之工作的公司。例如,Google。当他们发布Java编程工作时,他们也希望有Python经验。

我的一位朋友几乎知道所有广泛使用的语言,他在大多数项目中都使用Python。他说主要的原因是他喜欢源代码的外观。这可能是选择一种语言而不是另一种语言的轻率理由。但并没有听起来那么轻率:当你编程时,你花在阅读代码上的时间比写代码的时间多。你推着源代码团,就像雕塑家推着粘土团一样。因此,一种让源代码看起来丑陋的语言对于要求精确的程序员来说是令人发疯的,就像充满疙瘩的粘土对于雕塑家一样。

提到丑陋的源代码,人们当然会想到Perl。但Perl表面的丑陋并不是我指的那种。真正的丑陋不是看起来刺耳的语法,而是不得不用错误的概念来构建程序。Perl可能看起来像一个骂人的卡通人物,但在某些情况下,它在概念上超越了Python。

到目前为止,无论如何。当然,这两种语言都是不断发展的目标。但它们与Ruby(以及Icon、Joy、J、Lisp和Smalltalk)共享一个事实:它们都是由真正关心编程的人创建和使用的。而那些往往是做得好的人。


如果你喜欢这篇文章,你可能也会喜欢黑客与画家

The Python Paradox

August 2004

In a recent talk I said something that upset a lot of people: that you could get smarter programmers to work on a Python project than you could to work on a Java project.

I didn’t mean by this that Java programmers are dumb. I meant that Python programmers are smart. It’s a lot of work to learn a new programming language. And people don’t learn Python because it will get them a job; they learn it because they genuinely like to program and aren’t satisfied with the languages they already know.

Which makes them exactly the kind of programmers companies should want to hire. Hence what, for lack of a better name, I’ll call the Python paradox: if a company chooses to write its software in a comparatively esoteric language, they’ll be able to hire better programmers, because they’ll attract only those who cared enough to learn it. And for programmers the paradox is even more pronounced: the language to learn, if you want to get a good job, is a language that people don’t learn merely to get a job.

Only a few companies have been smart enough to realize this so far. But there is a kind of selection going on here too: they’re exactly the companies programmers would most like to work for. Google, for example. When they advertise Java programming jobs, they also want Python experience.

A friend of mine who knows nearly all the widely used languages uses Python for most of his projects. He says the main reason is that he likes the way source code looks. That may seem a frivolous reason to choose one language over another. But it is not so frivolous as it sounds: when you program, you spend more time reading code than writing it. You push blobs of source code around the way a sculptor does blobs of clay. So a language that makes source code ugly is maddening to an exacting programmer, as clay full of lumps would be to a sculptor.

At the mention of ugly source code, people will of course think of Perl. But the superficial ugliness of Perl is not the sort I mean. Real ugliness is not harsh-looking syntax, but having to build programs out of the wrong concepts. Perl may look like a cartoon character swearing, but there are cases where it surpasses Python conceptually.

So far, anyway. Both languages are of course moving targets. But they share, along with Ruby (and Icon, and Joy, and J, and Lisp, and Smalltalk) the fact that they’re created by, and used by, people who really care about programming. And those tend to be the ones who do it well.


If you liked this, you may also like Hackers & Painters.