views:

234

answers:

5

Coming from an enterprise systems background (think Java and Windows) - I'm surprised at the popularity of python as a prototyping language and am trying to put my finger on the precise reason for this. Examples include being listed as one of the four languages Google uses. Possible reasons include:

  • enables rapid systems application prototyping using of c++ libraries using swig wrappers
  • built to a well defined language specification
  • innovative features at the syntax level enabling high level of expressiveness
  • highly flexible web frameworks built long before other languages (django)

The questions is what makes it so popular/highly regarded, but to give some balance I'm going to give some reasons it might not be popular:

  • less tool support
  • less enterprise support (ie a vendor helpdesk)
  • lower performance
  • BDFL not caring about backward compatibility in version upgrades

Or was it just the best at a particular point in time (about 8 years ago) and other languages and frameworks have since caught up?

+11  A: 
  1. Highly expressive language. People often say, "Python works the way my brain does".
  2. Dynamic typing means you spend zero time appeasing the compiler.
  3. A large standard library means you often have the tools you need at your fingertips.
  4. An even larger stable of third-party packages (PIL, Numpy, NLTK, Django) mean that large problem domains are often well-supported.
  5. Open-source implementation means you don't have to grovel at the vendor helpdesk, you can find answers yourself, and get solutions from a large community of users.
Ned Batchelder
"Python works the way my brain does", well unfortunately my programming problems do not work like my brain.
Lothar
+4  A: 
  • enables rapid systems application prototyping using of c++ libraries using swig wrappers

... What?

Most people doing Python programming aren't doing C++ programming, they're doing Python programming. And they're doing it fast, because they don't need to worry about things like memory management, or templates, or... the sort of namespace support C++ uses.

Ignacio Vazquez-Abrams
+2  A: 

I started twelve years ago to replace my Perl scripts -- and the new ones were shorter and way more readable. So, readability and the gentle learning curve was the main reason to use it.

After version 2, the language has got more and more flexible, and with it my programming needs and I got used to do metaprogramming without even noticing. To see what I mean, have a look at the examples in SQLAlchemy's documentation.

You point to lack of tools -- but the last time I've seen a code generator has been ... I guess 10 years ago, and it was a bad idea even at the time, because you just don't need it.

The development team cares a lot about compatibility -- they ponder for years before introducing new syntax. Only mature modules go in the standard library, and python 3 has been discussed for ages. On top of the porting facilities, there is now a moratorium -- no new features to the language for at least two years.

As for performance - since I don't have to think about which methods throws which exception or having explicit interfaces for everything, and I have a lot more design patterns embedded in the language.. well, I am free to experiment with the architecture and optimize where it makes sense. Most of the time, for me, it's the network or the DB.

Marco Mariani
+1  A: 

In my experience, I haven't noticed less tool support so much as not needing big, heavy tools to get what I need from Python.

As to enterprise support there are distributions such as ActiveState and Enthought depending on your needs. We use AIX at my day job and while we did use AS Python at one point, the standard distribution works really well for us. We just haven't needed vendor support.

And I agree with Ned, I can't tell you how many times that instead of looking at the docs, I've just tried something and it just worked. I'm not talking necessarily about a familiar library but just being comfortable with the way Python thinks. This also means when I go back and look at old code, I seem to grok it a lot quicker.

And the main reason for choosing Python over other languages that I regularly use? It's fun and I enjoy spending time in it.

chauncey
+1: Don't need heavy tools. Bravo.
S.Lott
A: 

I think the flexibility and ease of use (readable code, lots of libraries/packages) are the big draws.

Regarding

  • enables rapid systems application prototyping using of c++ libraries using swig wrappers

I actually work on a Python product for mathematical and statistical analysis (PyIMSL Studio) designed specifically to address this issue, although we use ctypes instead of swig. For a variety of reasons lots of businesses use C/C++ in their enterprise applications. If they want to add some analytical functionality prototyping it in Python can be a lot faster than in C. Our Python libraries wrap our C numerical libraries 1:1, so once the prototyping is done the production development can take place confident that the same algorithms are available and the same results will be achievable. Bridging that prototype to production gap can be harder when moving from a very domain specific language like R or MATLAB to C than with a very general purpose language like Python.

Regarding

  • built to a well defined language specification

you should take a look at the public comments for the Security and Exchange Commissions's proposal to make Python be the language used in new assest-backed security regulation. Some people argue that Python should not be the language precisely because it does not have a well defined language specification other than (multiple) reference implementations. I love the language, but I would not view the language specification aspect as a reason why.

Finally, I think there are a lot of Pythonistas who would like to see their organization allow use of Python, or use it to a greater extent. From what I have seen, Python gets sneaked in at first for general, IT-glue kinds of projects, and from there starts being used in myriad other ways.

Josh Hemann