
The Python Paradox - tswicegood
http://www.paulgraham.com/pypar.html
======
samratjp
The single most reason why a language X (it's python for me today) wins my
heart is not because it's extra fancy or anything but the times when it gets
out of my way to let me think about the problem and then everything else seems
clearer. I write a lot in both Python and Ruby, but the days when I have to
dig into my old code, Python readability trumps over Ruby's (or anything else
for that matter).

~~~
aditya
Can you give me an example of Python readability trumping Ruby?

~~~
samratjp
It's simple, If I don't indent properly - I don't get to run my code in
python.

Yes, I know I can make my code look cleaner in Ruby, but I'm lazy. Call me
shallow, but sometimes not having to type in blocks and "end" is kind of nice
because of the inherent indentation constraint. And that indentation makes it
easier to find lexical scope hierarchy easily too (at least for me). YMMV :-)

~~~
rjprins
I think indenting and block syntax are absolutely trivial with any good
editor.

~~~
samratjp
You missed my point. I am talking about the code being cleaner to look at in
general.

~~~
stcredzero
It's just a trade-off. You get cleaner-looking code, which is much trickier to
copy off a random web page. The latter might seem trivial, but it's not so
simple. In an environment with ubiquitous browsers, many programmers start as
copy-pasters. (Just as many of us of earlier generations started out in
BASIC.)

I'm not saying this is bad. It just is.

~~~
wvoq
If you're trying to copy a non-trivial amount of code from a web page, you're
doing it wrong. In 2010, I think sharing code over the internet is a solved
problem.

~~~
stcredzero
Newbies often try to "do it wrong." I also wrote lots of really horrendous
BASIC. It was a learning experience. If you think of tab-soup as a Python
newbie right of passage, that's your prerogative.

------
Tycho
The real reason I prefer Macs to PCs is that I find the 'mental environment'
more pleasant. Uncluttered. Spacious. While you're working at a computer you
almost inhabit it, and while you may not have a luxurious apartment, you can
probably afford an iMac. I take it a step further by avoiding any software
that doesn't live up to the Mac 'feel.'

I describe it to people as 'feng-shui' for computers. I'm surprised I've not
seen that concept mentioned more in connection with programming. Python is
probably my favourite language. Probably due to the white-spacing more than
anything. And lack of those damn brackets.

~~~
bigfudge
I wholeheartedly agree. What's more, learning python and using textmate
regularly has ruined me for writing in MS Word... Not that I was particularly
attached to it before, but I now find it really hard to think or write with
all that junk (mostly broken - I'm looking at you styles) just sitting there.

~~~
guygurari
Try LaTeX, if you haven't already.

------
coderdude
Purely meta: It would be nice if HN could automatically show links to the
discussions that took place the numerous other times this and other links have
been submitted and front-paged. Seems like a lot of waste if each batch of HN
users has to re-discuss the article from scratch. I tried Googling for the
rest of them but so many irrelevant pages came up that I just gave up.

~~~
reason
RiderOfGiraffes scripted a bot that would do that automatically, but others
here thought it was some cheap novelty trick he was pulling.

~~~
gjm11
It was certainly novel, and probably cheap. In most other discussions on HN,
that combination would be regarded as a _good_ thing.

~~~
kmfrk
I don't really know what caused some - few? - people to have a fit. Maybe
anything that remotely reminds them of reddit calls for outrage.

------
abdulla
For me, I find Lua has more clarity and consistency than Python. From the
design of the language, to its implementation, to it's C API --- it's a very
beautiful language.

~~~
codexon
I'll have to disagree.

When I open up any substantial Lua project, I am flooded with local local
local and local. It drives me nuts coming from a Python background. Not only
is there that, but they decided to use "end" which is more cluttered and
longer than using brackets.

Lua also has no standard oop system which means you have to guess which half-
baked version the project is using. I'm sure there are other problems I forgot
to mention here.

~~~
newgame
I concur with your points. These are some of the problems I had, too, coming
from a python background. To add to your list: the # operator confuses a lot
of people as can be seen on the mailing list (although its semantics are well-
defined actually). Nevertheless there are also convincing reasons for these
decisions. Have a look at e.g. <http://lua-users.org/wiki/LocalByDefault>. And
the use of "end" certainly helps with anonymous functions.

Purely looking at the language resp. the consistency of the design I would
even say that Lua is more beautiful than Python even though Lua has its share
of warts. Note that this does not say anything about which language is easier
to use in practice (which is Python imho).

But that aside, I think it is important to mention that comparing Lua and
Python is a bit like comparing apples to oranges as they pursue _different_
philosophies. Lua gives you just as much as you need but no more. This is the
reason why it is so flexible and suited for embedding. Python, on the other
hand, is a full blown general purpose programming language with a huge
community/ecosystem.

------
gsivil
"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." This seems that is not the case anymore. I think that
since Python became more popular even in big corporations (see Google) the
Python Paradox should be in 2011 something else. You name it. The ideas
expressed in the essay are of course still relevant but the example maybe has
lost some of its accuracy.

------
illumen
The python paradox is not true anymore - since it is taught in so many schools
these days. Unlike in 2004 when the article was written.

However the main thesis holds true still... just replace python with haskell,
erlang, clojure, or some other esoteric language.

~~~
jerf
Ask a few questions and you can still work out whether they actually learned
it or just had it in class. Details depend on the curriculum in question, but
recently when we faced this problem at a university recruitment a simple "Hey,
what's a generator and why would you want it?" seemed to separate out the real
learners from the classroom coasters.

Not that it really mattered that much, you still want to see learning of
languages not in the curriculum and no 4-year program will ever cover all the
interesting possibilities. We just learned that where "Java, C++, C, nothing
else" is a warning sign from one university, "Python, C++, C, nothing else"
was the warning sign from that one. You could probably generalize to "C,
(Java/C++), exactly one other" and still be right.

------
sero
Just in case anyone doesn't notice, this essay is from 2004. The basic premise
is still a good one, even >6 years later.

~~~
zipdog
I still like the premise, although I feel that Python has become far less
esoteric while still retaining the favourite for a large number of quality
programmers. And I can't think offhand of any newer languages that have taken
it's place (maybe iOS counts?). But that might just be my small sample size.

~~~
tjarratt
From SF at least, I'd have to say Ruby, followed closely by objective c and
clojure.

~~~
iron_ball
Does anyone really think that Obj-C is elegant and powerful in the same way
Python, Ruby, or Clojure are? If so, I would like to hear the arguments for
it.

edit: I understand that the iOS SDK is well-thought-out and easy to work with,
but there could have been an equally good API for Python, Ruby, or (if your
argument is performance) one of the more performant lisps. I don't think the
SDK alone justifies Obj-C.

~~~
stcredzero
_Does anyone really think that Obj-C is elegant and powerful in the same way
Python, Ruby, or Clojure are?_

The iOS SDK is elegant and powerful in a different way. There is more syntax.
Designs tend toward more exposed entities. However, there is less coupling to
particular implementation strategies.

Let's take operations on dates as an example, specifically jumping to "the
same day of the next month." This is not as simple as you might think at
first, since months vary in length in an arbitrary pattern. In many high-level
language libraries, you simply grab your date and you do a single call. (In
Ruby: Date.today >> 1) With iOS, you end up having to use 3 different objects.
(Calendar, Date, and DateComponents)

Working in Objective-C reminds me of the best of "mainstream" Object Oriented
programming from the mid 90's. There is a bit too much arcana, seemingly too
many entities, but if you work through some real examples, you find that some
good thought was put into things.

------
julius_geezer
Actually, I learned it chiefly because what it would do for me on Windows: a
REPL plus access to COM. Need to bash around Excel spreadsheets & do funky
regexp stuff? Done. Do I like it? A lot? You bet. But I didn't pick it up out
of some existential need to improve myself.

------
slee029
this article holds especially true for non-technical entrepreneurs deciding
which language to choose. while the supply of developers may be lower for
languages such as ruby or python, you find a much more enthusiastic crowd of
developers who in general seem to already have graduated from another language
such as php. thus, from a business non-technical background, by choosing an
enthusiast type language such as ruby it made it easier to narrow down quality
developers with the right mentality as a technical co-founder than say a
language with a large supply of developers such as php.

~~~
inovica
That's exactly what I (business guy) did. I learned Python myself also though,
which made a difference. Reading threads on sites such as this had already
convinced me of the power of Python (over PHP) and I put together a couple of
demo apps to be developed in Python. Some of our guys have moved to it, some
have been more resistant, but the guys who have seem much more focused on what
they need to do.

------
Stormbringer
Last time I looked into Python, I was reading something where the guy was
going on about how awesome it is to get rid of all the cruft of C syntax, the
semicolons and braces.

Then as I started getting into it, and thinking to myself, yeah, a lot of that
cruft is just unnecessary, getting rid of it would be awesome... I tripped
over the underscores and passing of self in Python.

If the whole point of your syntax is to get rid of old ugly syntax cruft,
don't introduce new ugly syntax cruft at the same time.

------
aidos
While I agree with the approach described, in practice things can be a little
different.

We decided to start using python in our agency a couple of years ago. We
really love it but since that time we've really struggled to hire good people.
Even in a big city like London we can't seem to find python devs that also
have the other skills required for the agency world.

When I interviewed for this job we bonded over a shared interest in erlang (4
years ago). You don't need to use it internally but if you have a candidate
who is interested in something like erlang, they're (probably) deeply
interested in programming.

That's going probably a safer approach. Find people who do have an interest in
the more obscure parts of software development (easy to gauge in a phone
interview) whilst still practicing a more common language.

My point is that there's a much bigger picture to language choice. I'd rather
be trying to find perfect candidates from a flood of ruby cvs than struggling
to find any candidates at all from _insert lesser known language_ cvs.

------
ryanpers
The strange thing about python is it is almost TOO easy. I have worked with
developers who preferred python because basically they were not great
developers. The ease of development and attractiveness of the speed of
development was a lure.

The only problem is the overall systems they wrote were bulky, not efficient
and generally over-engineered. Very not hacker like. For example using threads
in python, a very big no no that can and does cause many performance issues.
Designing python middleware that had no reason to exist other than to be a
cool project to build.

And so on and so forth. Painful.

~~~
hasenj
> The strange thing about python is it is almost TOO easy. I have worked with
> developers who preferred python because basically they were not great
> developers.

I don't know what you're talking about.

Python requires some command line interaction. You have to edit text files,
read online docs, have a mental model of lists, dictionaries, and strings. It
doesn't come with a visual IDE, and it feels awfully foreign in a windows
environment. Why would a less-than-average developer even bother with such a
technology? It doesn't even come from Microsoft.

~~~
bigfudge
You're correct on all those points. And yet, to someone with no formal
training in CS (I'm an arts grad), python is so much more transparent than any
of the MS stuff I've had to use. I think it's primarily the predictability of
the naming scheme and the resemblance to pseudocode. The command line is not
that hard to get your head around, and you get dicts strings etc with the
first few chapters of Dive into python or 'How to think the a CS'.

In fact, it may be that these introductory materials are explicit about basic
language concepts which makes learning python so easy — they're not focussed
on solving your immediate problem (coding X), but solving the problems you
will face over the next few years/decades.

------
kakaylor
This essay does assume, of course, that you can find enough developers in your
locality that can write software competently in Python.

A few years ago I developed software (engine diagnostic/programming) for a
large semi-truck manufacture in the Midwest. Our primary concern when
selecting a language for a new product/project was whether or not we could
find developers who were competent in that language. That almost always meant
we chose Java because that is what our local developer pool was competent in.

~~~
kenjackson
That actually makes a lot of sense. While the Python Paradox may be partially
true, it only makes sense to use in selecting a language when you can't screen
applicants.

Once one can screen applicants, I think you're just as likely to find good
Java programmers as you are to find good Haskell developers.

~~~
blacksmythe

      >> I think you're just as likely to find good Java programmers as you are to find good Haskell developers.
    

While there are certainly more good Java programmers than good Haskell
programmers, I think that the percentage of Haskell programmers that are good
is higher than the percentage of Java programmers that are good.

    
    
      >> Once one can screen applicants,
    

It is a lot of work to screen applicants. If I were hiring a C++ developer and
had two similar looking resumes, I would certainly call the developer that
listed Haskell experience first.

------
epynonymous
very nice article, python's also my choice of coding language. i started with
c/c++ in college and then moved on to use c++/java at my first job. but for
the past 5 years it's been all python. i'd like to say that the reason is the
speed with which i can write applications; not having to think about types,
managing memory, or compiling source code helps remove some of the barriers
that plague software development for me. time is money and most of the time i
feel that i'm able to write applications much faster in python.

the language seems to blend all the best things, i'm never at a loss of
finding a good open source library for python and it's most of all relevant.
so even while ruby seems to be really popular at the moment because of the
rails framework, python also has equivalent* web app frameworks such as
django. i remember reading an article by the creator of python where he was
praising the php language for having purpose built the language for the web
and how python was more generic and less suited for the web (no reference at
the moment), today there are lots of excellent web frameworks for python such
as tornado web. so python is modern, it has adapted over the years quite
nicely, and most importantly it just lets me do what i need to do.

------
kenjackson
The now language is Haskell.

~~~
hasenj
It's probably gonna be coffee script on top of node.js

~~~
mcs
I'm an avid nodejs lover and coffee irritates me for some reason, but I agree
with you. It's combining some of the up points of python and ruby, and
hopefully it begins to get more traction.

