Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Other than being annoyed at whitespace as syntax, I'm not a hater, I just don't get the fascination with Python.

I appreciate the poetry of Perl, and have programmed beautiful web services in bash & korn, and shebang gnuplot. I write documents in troff and don't mind REXX. Didn't find tcl any more useful years ago, but what's the big stink about Python? I see job listings and many candidates with this as a prize & trophy on their resumes.

I guess in reality, I'm trying to personally become sold on this, I just can't find a reason.

share|improve this question

closed as not constructive by Mark Trapp Dec 17 '11 at 3:42

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

I never understand why people get annoyed at Python's required indenting. I hope you were going to indent your code anyway, right? – Greg Hewgill Sep 20 '10 at 3:46
@GregH, of course, but shall my syntax be mandated by it? Kind of like Makefiles? – Xepoch Sep 20 '10 at 3:47
@Xepoch: But Makefiles don't just require indenting, they require a specific kind of indenting that's usually indistinguishable from the other kind. If Makefiles needed any whitespace indent instead of specifically 0x09, you probably wouldn't object and would probably use consistent indenting in your preferred indent width. This is the same thing Python allows. – Greg Hewgill Sep 20 '10 at 3:55
Poetry of Perl? Seriously? If you have had the honor of maintaining other people's Perl code, you would understand why Perl has fallen in terms popularity. – grokus Sep 20 '10 at 14:03
@Greg, I agree with you. I said this before and I will say it again, whoever complains about Python's indentation rule should be asked to maintain poorly indented code. Just sayin... – grokus Sep 20 '10 at 14:05

16 Answers 16

up vote 55 down vote accepted

Python is a well-designed language with a reasonably clean syntax, a comprehensive standard library, excellent included and third party documentation, widespread deployment, and the immediacy of a "scripting" style language (ie. no explicit compile step).

share|improve this answer
I don't think it is totally cool exactly because it has been hacked along the history to get fresh. Python would be almost perfect if the language get really clean forgetting legacy syntax or semantics. P3 got better but much less than it needs. I don't remember a language that hurts more one of its rules, "one way to do things". – bigown Sep 20 '10 at 12:45
Well-designed? Ever noticed that you have a global function called len? – alternative Sep 23 '10 at 23:55
what is wrong with len? I get the impression you only read about python for 5 minutes – Kugel Nov 21 '10 at 2:56
@bigown: Read the Zen of Python ( again, and you'll see it says "there should be only one" and not there is only one. This just means "go the easy and obvious path" and don't do fancy stuff. – naeg Sep 26 '11 at 8:40
Personally, the language structure was so simple to grasp that it gave me a better understanding of how languages in general work internally. It's the little things. First class functions, ability to import only the relevant parts of a external module into the current, list comprehensions, tuples, the inclusion of self as a method parameter helped me understand the difference between functions and methods (other languages just hide behind sugar). It pains me to use languages like C# now because I know intuitively that the code isn't teaching me how anything about how it's working internally. – Evan Plaice Jan 17 '12 at 7:01

I've found Python to be the most natural programming language that I've ever written code in. I've coded in a lot of languages before and after Python, and to a greater or lesser extent, you have to fight the language to get it to do what you want. Python reduces this struggle massively. Eric S Raymond said it much better than I can in Why Python?

As a related point, Python maintains its cleanness even while evolving rapidly. In most languages I've worked with, introduction of new language features introduces a lot of wrinkles. But with Python, even major language features (decorators come to mind) are added all the time, without feeling like ugly hacks.

share|improve this answer
Came here to say basically this. The syntax just feels so natural, it's almost like you're writing pseudocode. – James Davies Sep 20 '10 at 4:10
Python is compact: you can hold its entire feature set (and at least a concept index of its libraries) in your head. – systempuntoout Sep 20 '10 at 6:57
@Zoomzoom83 My pseudocodes have begins and ends -- it it not working in python :-( – mbq Sep 20 '10 at 21:46
@mbq And my pseudocodes have braces, but that's another story ;) – Christian Rau Sep 25 '11 at 16:46

I hope this doesn't sound too cynical, but IMO Python is so popular for the exact same reason Java, C# and Objective-C are. Not because there's anything spectacular about the languages themselves, but because they've each got a magacorporate sponsor that's able to produce a lot of hype, a lot of advertising, and a lot of libraries and support for their preferred language.

share|improve this answer
C# is special, it has linq – Daniel Little Sep 20 '10 at 3:43
Python has a large corporation behind it? (genuine question) – Xepoch Sep 20 '10 at 3:45
Yeah, that's what I meant. Python was a whole lot less "cool" before Google started taking such an interest in it. – Mason Wheeler Sep 20 '10 at 4:17
@Mason - but surely, there must be some reason why a large corp like Google would make it "cool"? – Jas Oct 22 '10 at 22:31
Why do people think there are corporate sponsors of python? Has anyone noticed the size of pycon versus the huge Java/j2ee conventions? This is a David and Goliath story of corporate funding. – rox0r Dec 20 '10 at 15:55

My experience is that the people who find true joy in programming often seek a language that fits them better than what they learned at school or university. Basically this means that they will move from the default PHP / Visual Basic / C++ / Java / C# to something more exotic (business/careerwise) such as Python, Ruby, Haskell and even perl (because of it's enormous hack value and obscurity).

Don't get me wrong, there are very experienced C# / programmers who take great pride and joy in their work and code (the StackOverflow guys are a very good example), but you don't become a python programmer just because that's what they taught you in school; it has to be your own decision.

I think Jeff Atwoord had a blog post on this, but I can't find it. If I find it I'll update this comment.

share|improve this answer
Python was the first language taught at my school for 101. – Morgan Herlocker Jul 11 '11 at 13:20

Compared to Ruby, which is really cool and produces amazing Code Golf-offs, Python has this core philosophy that "There should be one - and preferably only one - obvious way to do [things]," meaning the idiomatic Python way. I have found this to be a huge advantage compared to Ruby.

share|improve this answer
..or compared to Perl with an seemingly infinite # of ways? – Xepoch Oct 23 '10 at 5:53
@Xepoch - actually, there's very often a lot less than infinity of good/correct ways of doing things in Perl, and most people with a clue will easily be able to tell you without TOO much disagreement what top 1 (or at most 2) are. if you don't believe me, look at Perl questions on SO. Yes, some quetsions have 10 distinct solutions. But most have a clearly agreed upon "most correct for circumstances" solution. – DVK Jan 13 '11 at 18:56
@DVK, I know, but looking at it from a design goal. – Xepoch Jan 13 '11 at 20:31

I started to love Python for the same reason that Eric S. Raymond describes: the act of writing programs in Python is conceptually very similar to thinking the act of designing code in my head.

Learning to be a good Python programmer made me a much better C# programmer. It made understanding LINQ much easier, for one. I might never have embraced a type like Dictionary<string, Func<T>>, or gotten comfortable using yield return, if I hadn't used classes and generators in Python. AOP is a lot easier to understand now that I've used Python decorators. The list goes on.

share|improve this answer

Firstly, trifling language quirks like forced indentation in Python matters little if the language itself is powerfully expressive and useful. I was also turned away at first due to it, but soon learnt to look past it and now don't even feel it as a hindrance, because the language is so much easier for me to work in. Its like sigils in variables in Perl, its a harmless language quirk and anyone comfortable in the language don't feel bothered by it.

To understand the reasons why so many people think Python is great, just try and learn the language. The reasons are mostly the same as Perl. I find I like the syntax in Python (e.g. list comprehensions, OOP syntax, etc.), but that is really subjective and your opinion might differ. I prefer Python for larger projects, while I still use Perl for smaller scripts.

And that is the answer to your question. You compare Python to Perl, bash and tcl. The thing is that is that is not a fair comparison. Languages like bash was designed for writing small scripts to automate common tasks. Some people think Perl also gets unwieldy if the code gets sufficiently large (well written Perl does not, but well written code is hard to come by in a large project). IMHO Python differs from other 'scripting' languages in that it scales very well to large projects as well as small one-off scripts. I think Ruby also has that same quality.

share|improve this answer

Since 2004, I've used Python to develop:

  • GUIs
  • Scripting ray tracer scenes with Python to C++ bindings
  • Cross platform automated build systems
  • Test scripts
  • General purpose tools to solve your everyday issues
  • Web sites and web apps

Back in 2004, Python was the language of choice because Python scripts are portable across Windows, Linux and Mac with very little modifications.

share|improve this answer
To quote a comment from different answer: "Not doubting Python here, but I think Perl fits your description above quite well if not better". – DVK Jan 13 '11 at 19:00

To me Python has been a dear friend. It's a decent scripting and prototyping language. The key things I can think of are:

  • Clean syntax, very simplistic and easy to understand
  • Multi-paradigm, use it as a imperative language? Sure. OOP? No problem. It also has some light functional language features, e.g. lambda, list comprehensions, etc.
  • For basic computing needs, it has native support for the essential data structures, array, tuple, dictionary (associative array), set, etc.
  • Other features can make a programmer very productive, e.g. duck-typing, reflection, meta-programming, decorators, generators, etc.
  • Rich library support
share|improve this answer
lambda is broken in python. – Paul Nathan Oct 23 '10 at 0:00
@Paul It wouldn't hurt to give a link to back up your opinion. – Piotr Dobrogost Nov 24 '10 at 22:05
@Piotr: Cannot contain statements. That violates the mathematical idea of an anonymous function. – Paul Nathan Nov 25 '10 at 16:37
Doesn't that mean lambda is unbroken? – rox0r Dec 18 '10 at 7:09

I think to some degree Python is the only programming language you'll ever need, unless you want to write an OS kernel. It is suitable for the interactive use, random hacks, system administration, scientific applications, operating system tools, web applications, GUI applications, embedding, etc. etc., it's portable, free, and widely used. No other programming language really covers all those fields in practice. It's a really good strategic investment for a person and a company.

share|improve this answer
Not doubting Python here, but I think Perl fits your description above quite well if not better. – Xepoch Sep 23 '10 at 14:41
Ruby does very well at this too. – Slomojo Sep 26 '11 at 0:07
As of 2015, Python is the de facto general purpose language of scientific computing. Everything else is either the classical low-level stuff (C, C++, FORTRAN), competitive in a few niches (MATLAB, Mathematica, R, Julia, Lua), used for libraries and infrastructure only (Java), random scripting tools (bash, Perl) or.... well... none of the above. – Paul Dec 28 '15 at 0:40

It's elegant and really easy to learn, and once you're familiar with its basic types (especially lists) your productivity has no limit. It's perfect for prototyping algorithms, or for writing them in a pseudocode-like language that can eventually put directly on a machine, and it's really good as a scripting language for doing repetitive jobs or perform annoying operations on files. I use it as a glue language for making subprocesses communicate with each other: not as powerful as bash for some easy tasks, but WAY easier if you need to do more than just a single line of code.

And then it doesn't distinguish between functions and subroutines, you know what I mean.

share|improve this answer

Many Python lovers I see just switched from C surroundings and were impressed with stuff like "Hello "+ "World" is "Hello World". So I would say this is the first scripting language that does not gathered esoteric/specific tag and so spread around among martyred people like fire in a dried forest. And so created fashion now lives on its own.

share|improve this answer

The philosophy that the Benevolent Dictator should enforce his idea of good style[1], his idea of good programming, his idea of how to program frustrates me regularly. I don't think like van Rossum. However, his language resists attempts to express non-van Rossum thoughts. His thinking works really well for many (most?) programmers. But I seem to not fit into his model of how to program.

That is why I believe Perl is a superior language.

[1] See his blog about removing reduce.

share|improve this answer
can you please expound on your reasoning with the thought process, would like to hear more. – Xepoch Oct 23 '10 at 5:54
@Xepoch - a programming language serves as means of expression. Idioms and styles of thought can be expressed in a continuum of thought from 'fits' to 'very hard to fit'. For instance, I do not think in terms of list comprehensions. They are alien to how I think about problem solutions. But Common Lisp's reduce is something that flows without significant difficulty out of my mind. However, van Rossum evidently is the opposite. Java requires all things to be in objects. So it becomes very difficult to create non-object-oriented solutions in Java. And so on - – Paul Nathan Oct 23 '10 at 15:04

Reapproaching the question now that I'm a little less tired:

Python is a language I've found particularly well suited for scientific programming tasks, which is one of the places where its popularity is growing pretty strongly. A few reasons why:

  • Fairly strong community support means there's some strong libraries in place, and Python works as a decent replacement for MATLAB and some of the other popular languages in that field.
  • It plays well with C when you do need speed, but often speed isn't really that necessary, so Python's interpreted nature isn't all that big of a deal.
  • I've found it to be a fairly approachable language without a huge number of what, to outsiders, feel like weirdly arbitrary syntax rules. It's pretty swift to translate between pseudo-code and Python.
  • "Take it or leave it OOP". A lot of scientific programming projects don't benefit all that heavily from extensive OOP. Some do. It's nice to have a language that can hop between the two easily.
  • Strong cross-platform support. Especially as what I work with rarely involves GUIs, I can pretty much rely on being able to send off a Python program to someone else without worrying about what OS they're running.

It's not the end-all, be-all of programming languages, but its a decent "Yeah, I probably have a tool to solve whatever problem comes up" language, which is probably why it's enjoying popularity at the moment.

share|improve this answer
Besides all other items you listed, I think one of the most important items was "I can pretty much rely on being able to send off a Python program to someone else without worrying about what OS they're running.". This is also very favorable when you don't want to get stuck with type of operating system. – Tarik May 1 '14 at 17:40

Python is a very 'webby' language in both the frameworks available (Django, Zope etc) and in the easily importable libraries, which again cover many web functions.

For web developers making the move from just a HTML, CSS + JS skillset (anecdotally a large source of new programmers over the past few years), I think this makes it a very attractive proposition (ditto Ruby).

Also, Google isn't Microsoft....

share|improve this answer
Java isn't MS, so if your reasoning is correct, they would be moving to Java not python. There must be a different reason. – rox0r Dec 18 '10 at 7:09

I think one of the main reasons is that 90% google is made from Python.

However, Python is also an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site,, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.

The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.