?

Log in

No account? Create an account
Python is now Blub! Run! - Arvind Narayanan's journal [entries|archive|friends|userinfo]

Python is now Blub! Run! [Jul. 2nd, 2008|02:32 am]
Arvind Narayanan
[Tags|, , , , ]

When Google AppEngine debuted last month with python as the only supported language for the time being, I realized with a shock that python is now Blub.

Blub, if you're unfamiliar with the concept, is Paul Graham's hypothetical "median programming language", the language that the average programmer uses. It makes the reasonable assumption that languages fall on a continuum in terms of power. Lisp and Haskell might be incomparable, but in general, languages differ so vastly in power that a linear ordering does not lose much information.

Why is the fact that I program in Blub such a bad thing for me? Because if you want to do a startup, you should have some reason to believe that you are several times more productive than the average programmer, an order of magnitude even. I say this with no hubris; I'm sure that on the other hand, a great hacker would outperform me by at least that amount. The great disparity in programmer productivity is well known, and is nothing to feel bad about. If it's any consolation, some other professions like math are even more skewed: Paul Erdos or Terry Tao have probably contributed more to the field than an entire army of average mathematicians.

Getting back on topic, I don't think that Blub has quite caught up with me yet: while I do use python almost exclusively, I think I use a subset that exploits its power rather well: I use virtually no mutable data, emulating the functional style (which, incidentally, means that I spend no time at all debugging; the concept is not even meaningful—if a program has no internal state except for it's return values, there is no point in inspecting its state.) I make heavy use of generators and lazy evaluation. Finally, I have developed and use my own "pype" syntax.

Nevertheless, the AppEngine announcement is a warning. Lisp and Haskell are basically the only languages that are considerably more powerful. I've been meaning to take up a Lisp project to hack on for years at this point; I think it is now imperative that I do so. This doesn't mean that I'm going to start programming exclusively in Lisp from now on—the libraries just aren't there. But not learning Lisp is not an option for anyone interested in beating the averages.
LinkReply

Comments:
[User Picture]From: theswede
2008-07-02 07:50 am (UTC)
Productivity in a programmer is not particularly strongly tied to the language used though. And Lisp, while powerful for certain tasks, is most certainly not the most productive choice for many applications. Sure, if you want to write AI routines, it'll be hard to beat, but how often do you actually do that? Most of the programming I do would be much better done in Python. Sadly I'm forced to use Rapid (a FORTRAN like robot control language with no OO or functional support at all), VB.NET and to some extent C#.NET. The main reason being device support (ABB robots only work with Rapid) and ability to interoperate with other programmers on projects (hardly anyone knows Python).

In addition, it's a lot harder to make GUI's quickly in Python than in the .NET languages, and it's much harder to make easy to deploy executables. In practice this means a lot more to our productivity than the power of the language itself, and I don't doubt that is generally true of most environments where productivity actually matters (which is fewer places than one might envision).

That said, learning more languages and particularly more paradigms is going to help your productivity immensely. Getting a good, solid understanding of functional programming by using Lisp will make your Python development much more efficient, for example.
(Reply) (Thread)
[User Picture]From: arvindn
2008-07-02 07:58 am (UTC)
yeah, i agree with most of that (except for the lisp=ai part). since i don't write desktop apps, my gui programming is limited to javascript, which is about the same level as fortran :) my post was written with server side stuff in mind, which is where i spend most of my time.
(Reply) (Parent) (Thread)
[User Picture]From: theswede
2008-07-02 08:34 am (UTC)
AI is a pretty broad field, and Lisp does excel at it, but of course it's got lots of use outside of that. However, it's hampered by a rather unwieldy syntax when working with many common tasks. Of course, that's true of C++ as well, and it's doing well in the mainstream (don't ask me how, I have no clue) so maybe it's no real obstacle.

For server and servlet programming the GUI and deployment side of things don't matter much, this is true. And the stream/list nature of Lisp may very well be rather productive there. Would be interesting to hear about your experiences if you give Lisp a solid try in these applications. I admit I've never looked much at it. For that kind of applications I've worked mostly in Java, Smalltalk and scripting, although at times I've been forced to implement VB6 solutions *shudders at thought*.
(Reply) (Parent) (Thread)
[User Picture]From: arvindn
2008-07-02 07:17 pm (UTC)
"And the stream/list nature of Lisp may very well be rather productive there."

yeah, i expect it will -- most of my server side work seems to be data driven and stream oriented.
(Reply) (Parent) (Thread)
[User Picture]From: haran
2008-07-02 12:38 pm (UTC)
>my gui programming is limited to javascript, which is about the same level as fortran

er, maybe you need to spend more time with javascript?

Its funny how in Graham's article on blub (or maybe it was a different one) he uses a litmus test involving writing an accumulator with closures.

Python could only do it with a bit of a kludge while other 'dirtier' languages like javascript could handle it elegantly in lisp-ish fashion.

Javascript certainly has its warts (implicit globals being one of the biggest), but its a very productive language if you know to side-step them.

Fun fact: Javascript was originally written for Netscape's browser and was called livescript. The author implemented it with a scheme-like syntax. His manager told him there was no way in hell people are going to learn to script in scheme and ordered him to change it to something modern. So what he finally delivered was scheme with java syntax.

Sorry, no citation for that, but I've read it in several places on the internet so it must be true.
(Reply) (Parent) (Thread)
[User Picture]From: arvindn
2008-07-02 08:32 pm (UTC)
revenge of the nerds. http://www.paulgraham.com/icad.html just read it.

that's just really unfair to python -- the fact that it doesn't have lexical closures is probably it's #1 wart. in general python is just a whole lot more elegant than javascript.

a major problem with js is not just the language itself, but also the implementations -- shoddy error reporting and inconsistencies.
(Reply) (Parent) (Thread)
From: (Anonymous)
2008-07-03 03:28 am (UTC)
I agree about inconsistencies and error reporting (although I have to say firebug has made much of that go away). On the whole, I prefer writing code in python than in javascript for those reasons you gave. But sometimes when writing python I really do wish for some of the stuff that javascript has in it and I hardly feel the converse when I write javascript code. e.g, I really like being able to define anonymous functions on the fly and pass them around. I guess it matters more when you're doing the type of programming that you typically do in javascript (ie, basically asynchronous stuff on the browser). On the other hand, generators and list comprehensions are really nice and javascript has neither. So its a trade-off.
(Reply) (Parent) (Thread)
[User Picture]From: mmk
2008-07-02 08:58 am (UTC)

Very interesting

For a bunch of reasons, I've been thinking of poking around with Ruby, this might just have been the tipping point.
(Reply) (Thread)
[User Picture]From: arvindn
2008-07-02 07:19 pm (UTC)

Re: Very interesting

good for you. there are things i miss about ruby even though i have never used it :) the lack of distinction between callable and non-callable attributes is the primary one.
(Reply) (Parent) (Thread)
[User Picture]From: haran
2008-07-02 12:54 pm (UTC)
I've heard good things about O'Caml. Its supposed to have decent library support (at least compared to Haskell) which is ironic because O'Caml was supposed to be a more academic language than Haskell (or so I've heard).

I'm not yet sold on lisp. I know that companies like Orbitz use it in their super complex systems but it always seemed to me that they were good because they just happened to be really smart programmers who just happened to like lisp a lot rather than because of any productivity gain with lisp (if you read the blurb they wrote about using lisp, they had to leave out some of the features that make lisp attractive like closures and macros for performance reasons). And also, the reddit guys rewrote their app but I guess you already knew that.
(Reply) (Thread)
[User Picture]From: arvindn
2008-07-02 07:21 pm (UTC)
oh, i think learning any of ocaml/haskell/ml/lisp/scheme is vastly better than learning none of them. i say pick any one of those and run with it!
(Reply) (Parent) (Thread)
From: (Anonymous)
2008-08-17 10:03 pm (UTC)

Popular = bad?

So, you're saying that Python is now bad because more people are using it?
(Reply) (Thread)
[User Picture]From: arvindn
2008-08-18 01:42 am (UTC)

Re: Popular = bad?

how about you keep the non-RTFA comments at news.yc?

that's not what i said. more people using python doesn't make python bad in itself, it just means that i have less of an advantage over the competition.
(Reply) (Parent) (Thread)