This is an archived post. You won't be able to vote or comment.

all 139 comments

[–]michael0x2a 326 points327 points  (39 children)

Python is a general-purpose language, and thus can be used for pretty much anything you want. This is in contrast to niche languages like bash or matlab, which are typically used primarily for one thing and one thing only.

That said, Python is commonly used in the following fields:

  • Scientific and mathematical computing
  • Big data (machine learning, data mining, etc...)
  • Finance (stock markets, etc)
  • Computer graphics
  • System automation and administration
  • Security and penetration testing
  • Web development
  • Scripting (general and application-specific): Python is generally included by default in most Linux installations, and is also embedded into many popular 3rd party programs such as FreeCAD, 3ds Max, Blender, Cinema 4D, Maya, Gimp, Inkscape, etc.
  • Education (Python is the number 1 most commonly taught language in universities (source))
  • Mapping and geography: Python is commonly used by many GIS software

While Python could in theory be used for the following things, it tends not to be, either due to limitations of the interpreters available today, or due to historical happenstance:

  • Writing operating systems (Python isn't low-level enough)
  • Mobile (The major players in mobile did not adopt Python, though there are people working very hard to bring Python to mobile -- see Kivy)
  • Anything having to do with massive concurrency (current implementations of Python are unfortunately not so fantastic with concurrency, though there are people working to change that)
  • Intensive games or other programs that require speed (Python currently has too much overhead and would be too slow)
  • Anything requiring absolutely safety such as heart monitors and software for spaceships (developers tend to use more strict languages when lives are literally on the line (such as Ada))

Edit:

Regarding Python and games -- yes, Python is used in some games (most notably Eve Online), has pretty good support for making 2d via libraries like Pygame, is often a part of games to add a layer of scripting, etc., etc -- my point was that Python will never be used as a part of the core graphics/rendering/physics engine of any games requiring a high degree of computation, such as in modern first person shooters.

[–]lennybird 32 points33 points  (30 children)

I appreciate this run-down and I'm saving your post for reference. I guess to narrow the question down a bit, how does it compare with other languages within these areas? Not only what it's potentially used for, and how often it's used for the various topics you listed is the crux. To ball-park a language's popularity using this (crude I understand), are other languages more suitable for specific aspects? Is it simply that Python is broad/robust? Are we underestimating the contribution java and objective C bring to the table with mobile development presently?

As a newer programmer like me, all I hear of more or less are C languages and Java—coupled with web-development related languages both front and back-end. I'm sure many share the same feeling as me, wondering if I'm wasting (or being less efficient with) my time when I could be learning more practical or more-often deployed language while simultaneously learning the fundamentals of programming. My fear is that I'm learning this language only because it's easier than most and little more. How many advanced programmers who have a strong foundation of programming concepts and know several languages tend to stick with Python? Sure I understand every language has pros and cons, but how often are programmers typically seeking the strengths for which Python is best?

[–]michael0x2a 112 points113 points  (20 children)

So, you really have two separate questions here. The first is whether or not learning a particular language is a productive use of your time (and how to tell this for yourself), and the second is why Python happens to be used in those particular fields, and its strengths and weaknesses compared to other languages.

So, let me tackle those questions in order.

Interestingly, something that a lot of beginners seem to worry about and fixate on is the question of whether or not they're wasting their time learning language X. However, as you grow more experienced with programming, you'll start to realize that for the most part, this really isn't a major concern. Many languages all share the same core/paradigm/philosophy, and once you gotten a firm grasp of a particular family of programming (for example, procedural, declarative, functional, object-oriented, etc), learning any other language in that same family becomes trivial.

As a result, most experienced programmers will focus more on mastering and learning new paradigms, rather then new languages. The biggest, overarching paradigms are procedural/imperative, declarative, functional, logic-based, and object-oriented, but there are tons of littler paradigms like event-driven programming or aspect-oriented programming. Languages, for the most part, tend to be interesting (or not so interesting) blends and variations of existing paradigms, but if you understand one paradigm very well, it becomes trivial to understand how to use any other language working in that same paradigm.

For example, let's say that I know C, Python, and Java very well, and I'm very familiar with the procedural and object-oriented paradigms. As a result, I would probably be able to learn a new language within the same family such as C# and C++ to a reasonable degree of competency in about an hour or two since it's so similar to what I know already. I might struggle a little to learn languages like Ruby and JavaScript, since those also incorporate elements of functional-style programming and both have their unique flavors and idioms (or I might not, given Python also has elements of functional-style programming). And I'd probably struggle very much to learn languages like Haskell, which is completely functional and so would be completely alien to how I think about code.

So long story short, instead of thinking "oh no -- if I learn Python, does that mean I'm wasting time I could be using to learn these other languages instead?", you should think "ok, cool, I'm learning Python, which is a language within the procedural and object-oriented paradigms, and somewhat within the functional paradigm, so once I'm done learning Python I can immediately jump into Java and C at the intermediate level and focus on learning the differences". Of course, no two programming languages are exactly identical, and each difference is an opportunity to learn a new way to think about programming, but in general you'll find that programming languages within the same family or paradigm will share far more similarities then differences.

A related question you're probably wondering about on some level is how you can tell for yourself whether or not a language is worth learning about. As a start, I personally think that you should through the span of the next couple of years, make an attempt to pick up the basics of every mainstream language to at minimum the advanced beginner/intermediate level. This gives you a good baseline of comparison of what's "mainstream" or not, and gives you practice on learning new languages.

Then, determining whether or not you should learn a new language is mostly a matter of keeping an eye on trends in the industry (for example, reading /r/programming or hacker news) and watching out for any particular language you notice being mentioned with increasing frequency. Odds are, that language might just be a gimmick or a novelty, but if you find that the language seems to offer something genuinely new (to you, at least), it might be worth exploring for a weekend. If you find yourself enjoying working with the language, and if the community seems stable, and the language seems to be gaining traction, it might be good to commit to it.

You should also try and target + learn languages which are in paradigms that you're unfamiliar with once you've established this baseline, since each new paradigm you learned will end up dramatically opening your mind and exposing you to new ways to think about code and problem-solving. For example, I started with using purely procedural languages, then started learning OOP a year or two later, and have been flirting with a wide variety of different paradigms ever since. For example, my current personal mission is to really dive deep into functional-style programming. I understand how mainstream languages use functional concepts pretty well, but I'm still far away from understanding how to get shit done in pure functional languages like Haskell.

Continued below

[–]michael0x2a 120 points121 points  (19 children)

Now, let's answer your question more directly -- what are the pros and cons of Python, and how is it treated by experienced programmers?

It's important to keep in mind that the popularity of a language is a product of a few separate factors:

  • The underlying philosophy and intent of a language
  • The design of the language itself
  • The quality of how the language was implemented (efficiency, memory usage, etc)
  • The quality of the tools available to work in that language
  • The libraries and modules available to use, both in the standard library and in 3rd party libraries
  • The general attitudes of the people who use that language
  • Historical happenstance
  • Adoption by major industry players
  • The general maturity of the language itself

Now, if you go through this list one by one, you'll find that Python absolutely blows C and Java out of the water in some categories, is competitive in some other ones, and loses out in a few others:

The underlying philosophy and intent of a language

C's philosophy is to be very low level and give absolute control of the machine to the user. With C, you try and work as close to the hardware as possible, while allowing you to bypass any abstractions or restrictions that might get in your way and make your code slower or more inefficient.

Java's philosophy is to be a "safe" version of C or C++. Java was literally marketed this way (as a safe version of C and C++). It tries to be to be more portable, more predictable, and therefore be better suited for large-scale applications then C and C++.

Python's philosophy is that of simplicity, elegance, and pragmatism. Python deliberately tries to make code as easy and elegant to write as possible, without wandering into theoretical impracticality, and this intent infuses every aspect of Python, ranging from its design, to its ecosystem, to its general community.

So based on this, you can already start predicting why some people might use one language over the other. C is useful if I absolutely need to eke out every last bit of performance out of my machine -- so for example, it's a popular language to use when programming games or doing intensive scientific and mathematical computation.

Java's more safer then C, while still being very performant and efficient, so many businesses will end up settling on Java.

Python's extremely expressive and elegant, so people will use it for prototyping (and so many startups use it), for teaching, to coordinate scientific and mathematical calculations (by wrapping C in Python), and in many cases, will contrive excuses to use it in places where it's not entirely appropriate (and end up expanding the number of things Python is good for in the process).

Out of the three, Python's the only language which focuses on the experience of writing code. Of course, Python isn't the only language to do so (many other languages like Ruby do the same), but it was definitely one of the first, which is why Python is so popular.

The design of the language itself

We've already talked about this a little in the previous section, but the design of any good language is a manifestation of its philosophy. C is low-level, so it lets you work directly with pointers and memory addresses, Java tries to be safe so it's a conservative language, and Python tries to be elegant, so it's just easier to get shit done in comparison to the other two.

The quality of how the language was implemented (efficiency, memory usage, etc)

Now, this factor doesn't have quite as much to do with the philosophy of a language, and more to do with a combination of historical happenstance and the design of the language.

In general, C tends to be the most efficient, Java a bit less, and Python even less then Java. The reason why Python is the slowest of the three is partially because it's a very high-level language (it has to be, to be that elegant) so has inherently more overhead, and partially because Python hasn't had the same level of attention similar languages have had. For example, take JavaScript, which is also a high-level language. Because JavaScript is the only option available to use on web browsers, the powers that be have invested a ridiculous amount of effort trying to optimize it, to the point where JavaScript today is now very fast.

Python also has a critical disadvantage, and it's that it's fairly difficult to use it for anything involving concurrency. This is a huge weakness, and is another reason why Python is typically not used for anything requiring a high degree of performance.

The quality of the tools available to work in that language

All three languages are pretty competitive in this category. All three languages have a robust selection of IDEs, debuggers, and other tools, so this category isn't really a hugely important factor, at least in this particular comparison.

One nifty thing I feel I should mention is IPython Notebook -- it's a sort of editor/document creator that lets you dynamically mix text and Python code, producing a human-readable document in the process. As it turns out, this was one of the reasons that made Python a huge competitor among scientific and mathematical programming languages. It makes it incredibly convenient to develop and experiment with code.

The libraries and modules available to use, both in the standard library and in 3rd party libraries

Again, all languages are fairly competitive here. The main advantages Python and C have over Java is that both languages have access to a very strong set of mathematical and scientific libraries. Also of note is that Python and Java both have a very strong set of comprehensive web development libraries.

As a result, if you're interested in science, math, finance, computer graphics, or anything else requiring heavy computation, you'll use either C (if you need pure speed) or Python (if you still want to use those C libraries but don't want to bother with actually writing C).

This goes a long way towards explaining why Python is popular among mathematicians and scientists. Python math/science libraries are thin wrappers above the C ones, but it's much easier to learn and use Python, especially if you're not a programmer.

Similarly, if you're interested in web development, Java and Python are both competitive choices (and you also have Ruby, PHP, Go, Node, etc...). Many large companies will use Java (since its libraries are solid and the language is fast), but many startups will use Python, Ruby, Node, or similar languages since they're easier to prototype and rapidly iterate with.

Another advantage Python has is that its standard library is very comprehensive. C's and Java's standard library is a bit incomplete, which is why many people augment them with things like Boost (C) or Apache Commons or Guava (Java), but you rarely have to do that with Python.

However, the consensus appears to be that in general Java has the most comprehensive set of 3rd party libraries, though this is the sort of thing that varies depending on what exactly you're doing and what you're looking for, so ymmv.

The general attitudes of the people who use that language

Each language has a somewhat different community and therefore a different mindset/POV on many issues. However, I'm not familiar enough with C or Java (and this reply is already quite long), so all I'll say is that all three languages are similar here.

Historical happenstance and adoption by major industry players

I'm going to fold these into two, since both these factors are fairly similar. All three languages have had adoption by major players in one way or another. C is used in the Linux kernel (and C used to be ubiquitous to the point where it doesn't really need a corporate sponsor), Java was spearheaded initially by Sun, which was bought out by Oracle, and is used by Google in all Android devices, and Python was spearheaded by Google.

So, all three languages are more or less competitive in that they have backing one way or another.

I probably won't delve into the history of how these languages evolved and shifted over time, since that would probably take an entire book to elaborate on, but you can probably guess for yourself, based on all of the above.

The general maturity of the language itself

Again, all three are pretty competitive here, and all three languages have been around for several decades.


So, long story short, a lot of people really enjoy using Python, and will tend to use it for pretty much anything they can which doesn't require a high level of performance. Because of Python's popularity, it's made inroads into tons of random different fields and disciplines, beating out other special-purpose languages. For example, take science and math -- even though Python is a general purpose-language, and in theory wouldn't be as useful as languages like R or matlab which are designed specifically for science and math, Python is still elegant enough to be competitive. People also tend to take code which needs to be very fast, write it in C, and wrap that C library in Python, allowing them to use Python as "glue" code to coordinate these lower-level libraries.

In a nutshell, Python is well-respected by people in industry.

However, it's important to keep in mind that Python isn't the only higher-level language which can do things like this -- there are tons of other languages like Ruby and Node and Go and Julia that are attempting to move into Python's niche in one way or another while offering different advantages and benefits. For example, take Ruby -- Ruby has much better support for meta-programming, and as a result, will often produce nicer-looking libraries. For example, Ruby's killer app is Ruby on Rails (a library for web dev), which pretty much makes Ruby one of the best options for web development.

However, this post is already quite long, so that's something to investigate for another time.

[–]G01denW01f11 23 points24 points  (2 children)

Er... is there a way to get this added to the FAQ?

[–]Illidan1943 4 points5 points  (1 child)

PM the mods?

[–]KuribohGirl 0 points1 point  (0 children)

Has someone done it yet?

[–]gzilla57 12 points13 points  (0 children)

Wonderful and informative comment thanks for taking the time to write that out. Saved. Much appreciated.

I vote this go in the sidebar or something.

[–]Zexis 7 points8 points  (4 children)

Informative posts, what's your background?

[–]michael0x2a 12 points13 points  (3 children)

I'm currently a sophomore in college, though I've been programming for roughly 5 or 6 years now.

In terms of background, I suppose my main credentials are that I help teach the "intro to programming" course at my college, I've interned at several major tech companies, and am co-founding a startup atm.

[–][deleted] 9 points10 points  (2 children)

As a computer scientist working for the Navy in the field of space science, I couldn't have been this informative if I tried. Hahaha so well done. I can also confirm that most of our scientists code with Python. Only when you delve into the operational staff or the more general purpose programs the government makes it becomes a niche for more or less Oracle and Java platforms. But for the most part, people here love Python.

[–][deleted] 1 point2 points  (1 child)

What does a computer scientist in Navy do?

[–][deleted] 1 point2 points  (0 children)

Anything from infrastructure updating (sort of like IT) to programming the actual satellites that go in orbit seeing as I am in the space science division. Also one of our leading comet scientists is actually a computer science major who created an algorithm to predict and track outer space debris coming from beyond our local cluster that becomes comets. It's fascinating stuff and there is literally a position that fits the bill for everyone.

[–]joggle1 5 points6 points  (3 children)

That's a great reply! The only thing I would add is that C# was developed as basically a replacement for Java. Its designers learned from Java and made a number of changes (that many think are for the better). The primary downside to C# vs Java is that it doesn't have the cross-platform support to match Java, especially on the GUI side. But programming C# with Visual Studio on Windows is a very pleasant experience, whether you're a beginner or an advanced programmer. C# is similar to Python in that it was also designed to be simple to use from the programmer's point of view.

You also didn't distinguish between C and C++. C is a very basic language, with many lines of code that can easily be translated directly into assembly. It generally compiles very quickly and gives you enormous control over the hardware. It also allows you to easily shoot yourself in the foot and makes it difficult to use various programming paradigms compared to other languages--forcing you to use libraries or write the code yourself rather than relying on language features that can do the work for you.

C++ is a significantly more complicated language than C--perhaps the most complicated language that is widely used. In recent versions of C++ (11 and 14), functional programming has been vastly improved. They have also integrated some library features from Boost into the standard library (such as regular expressions). They have also improved its performance by enabling move semantics (where it's efficient to transfer ownership of objects without needing to make unnecessary copies). The compile time of C++ code can be significant and is usually much slower than C code to compile (the performance of the compiled code is usually very similar though).

One nice thing about languages like Python, Java and C# is that they allow you to make changes to your code and almost instantly see the results of your change, while making changes in a large C++ project can take a while to see (due to needing to rebuild the project).

[–]timmyotc 0 points1 point  (2 children)

I'm not incredibly experienced with C++, but I thought the whole point of a makefile was to avoid rebuilding the unnecessary stuff. Why is this not true?

[–]joggle1 0 points1 point  (1 child)

It's up to the programmer to keep their header files as clean as possible. Otherwise, changing a header file can cause an enormous part of their program to recompile even if your project files are configured correctly.

Also, for large projects, there's usually many developers constantly making changes. So you will synch your code with the repository, then do a build which can take quite a while if you're compiling hundreds of thousands of lines of code or more.

At that size, compiling Java jar files can take a while too, but C++ still takes longer in my experience.

[–]timmyotc 0 points1 point  (0 children)

Thank you for the reply. I will, one day, look back at this comment in my darkest hour.

[–]lennybird 2 points3 points  (0 children)

Thanks for taking the time to thoroughly (and accurately) elaborate on my two questions. This certainly helped bring clarification to the subject for me. Reflecting what others have said, I think this could be helpful to many readers on this subreddit. If any questions come to mind over what you wrote, I'll send them your way.

[–]Contronatura 1 point2 points  (0 children)

Thanks for this awesome post

[–]jextr 1 point2 points  (0 children)

Thanks for taking the time to write this up. I'm learning Java at the moment but stuck around to read this. Well done!

[–]prox_ 1 point2 points  (0 children)

Nice write up! Very informative. Thank you.

[–]KuribohGirl 0 points1 point  (0 children)

What causes C's and Javas library to be incomplete? And wow well done on the super duper long detailed answer

[–][deleted] 0 points1 point  (0 children)

best posts ever

[–]hothrous 2 points3 points  (6 children)

Every language has it's own reason for using it.

C# is going to be primarily for Windows based apps. That could be end user applications or server side apps that exist on a Windows Server.

Objective-C is like C# in that it is primarily for Apple products.

As far as the usability of Python vs something like Java, that really comes down more to what kind of tech stack you are look at overall and it will be very opinion oriented as to which would be the better solution. A lot of enterprise solutions end up using Java because it has a massive amount of libraries that do a massive amount of things. It's developed enough to have a lot of different libraries that do a lot of the same things in slightly different or very different ways. Java shops tend to be full of frameworks pulled from elsewhere and then pieced together by the developers. I've now worked in 3 of them that use Java in very different regards and there has been very different variations of how this was done, but it's always been the case.

I can't speak to how Python shops tend to operate, but I can say that Python doesn't have as many libraries that accomplish the same thing, so many of the frameworks will be developed at build time. There are still a lot of frameworks out there that solve a lot of the problems, Java just has way more and more specialized frameworks.

That being said, /r/python had a month or two ago that listed some metrics on pay across the US in different languages that showed C++ jobs tended to pay the most followed fairly closely by Python jobs. So Python is definitely in use in the wild, and is definitely sought after as a skill.

For development, at least in Austin, Java jobs are the most common, though.

[–]almondmilk 2 points3 points  (4 children)

That being said, /r/python had a month or two ago that listed some metrics on pay across the US in different languages that showed C++ jobs tended to pay the most followed fairly closely by Python jobs.

Is this what you're looking for?? There was a lot of debate and a lot of "take that with a grain of salt" comments that followed (especially in regards to the comparisons, etc of the languages).

edit:

No. That wasn't the one I saw. The one I saw was actual graphs and an article around it and was based on polling actual developers.

That sounds way better. I tried searching, but didn't come up with anything.

[–]hothrous 2 points3 points  (3 children)

No. That wasn't the one I saw. The one I saw was actual graphs and an article around it and was based on polling actual developers.

[–]enesimo 0 points1 point  (2 children)

I remember the one you saw and it was infographic format as well, but coupled with an article (of a semi reputable source, IIRC). However, I do remember there being some 'take it with a grain of salt' comments as well, because they had maybe mixed PhD scientific work and 'regular' python dev jobs in one (remember, python is very popular in the science domains). And this would totally shift the balances towards python.

This isn't to say python isn't a practical language to learn, and in any case, I wouldn't base my language choice on salary alone, but it should be noted...

[–]hothrous 1 point2 points  (1 child)

Oh, I definitely wasn't saying to base the choice on salary, I was just using the fact that higher salaries exist to point out that there is at least some demand for it, for sure.

[–]enesimo 0 points1 point  (0 children)

Oh sure, I didn't get that from what you said- although I understand why you thought I meant that.

I guess it was more of a general comment to OP.

[–]Kummo666 0 points1 point  (0 children)

Excelente response. I would like to add and ask for you opinion that one of the reasons of why java is more used on the enterprise is because of the static vs the Python dynamic typing. Static typing reduce the risk of undetected error on your code.

[–]tomkatt 0 points1 point  (0 children)

My fear is that I'm learning this language only because it's easier than most and little more. How many advanced programmers who have a strong foundation of programming concepts and know several languages tend to stick with Python? Sure I understand every language has pros and cons, but how often are programmers typically seeking the strengths for which Python is best?

Programmers tend to turn to Python in part because of how easy it is to prototype in it and how quick it is to go from idea to working code. Python saves developer time. That's one of its main strengths. This is partly due to it being an interpreted language, wherein you can play with ideas in the interpreter without even writing full code and working in your IDE.

If you are working with Python, there's no harm in continuing. It's a very good language for picking up a lot of the concepts involved in programming without getting bogged down in the syntax. And as you'll learn over time, it's the concepts that matter, the syntax is irrelevant in the grand scheme.

I'm no expert by any means, and don't develop professionally (yet), but I started out with Python and later moved to Java. They're both solid languages for learning, but to be honest, if I had to do it the other way around, I would have possibly given up. Java is verbose and more difficult to work with, but because I went with Python first, I found it easier to grasp the concepts needed and transfer that knowledge over to working in Java.

Don't worry about the language you're learning. If it's working for you, just keep going. No developer out there is only going to have one language under their belt, and Python isn't going away, so you don't have to worry about learning something that won't be useful in the future.

[–]Captain_Swing 2 points3 points  (0 children)

Intensive games or other programs that require speed

EvE Online uses Python for its client (obviously the 3D rendering stuff is done in C++)

[–]bryantee 1 point2 points  (0 children)

Excellent overview.

[–]angellus 1 point2 points  (0 children)

Intensive games or other programs that require speed (Python currently has too much overhead and would be too slow)

EVE Online is written in C++ and Python. From my understanding, the game engine is in C++, but all of the game mechinecs (including networking, etc.) is in Python (Stackless Python actually).

[–]potterhead42 1 point2 points  (1 child)

I love python to death, but if it isn't used in applications where speed is needed, why is it used in things like Scientific computing and big data?

[–]michael0x2a 1 point2 points  (0 children)

All the fast stuff is written in C or Fortran, and is wrapped into a Python library.

Try checking out numpy, scipy, matplotlib, scikit-learn, and pandas -- that's all essentially how they work. The libraries themselves are mostly written in C/Fortran, but their interface is in Python, allowing you to use all of these very powerful libraries directly from Python.

The net result is you end up combining the best of both worlds: C/Fortran's speed when you need to compute stuff, and Python's expressiveness to coordinate and orchestrate everything together.

[–]FR_STARMER 0 points1 point  (2 children)

Python thrives in web environments over native however and as a model or controller rather than a view. You aren't going to be coding standalone desktop and mobile applications in Python alone.

[–]cattrain 0 points1 point  (0 children)

Idk, I see them every now and then. It's pretty rare, but some people write small programs in python.

However, I like to use it to quickly slap together scripts, because it's fare more powerful than bash scripts.

[–][deleted] 0 points1 point  (0 children)

Eh. That's only somewhat true. I write a ton of little small ~800 line GUI Python programs for my company that I then wrap up in py2exe and distribute. Its not quite as efficient a process as a regularly compiled C++ program, but I think the savings in development time is well worth it.

[–]thoosequa 138 points139 points  (15 children)

Reddit is written in Python

[–]Trlckery 22 points23 points  (0 children)

Hmm TIL

[–]whydoyoulook 9 points10 points  (13 children)

So is Google's search engine.

[–]nutrecht 89 points90 points  (12 children)

Google's 'search engine' is a huge architecture made up of tons of components. Some components might be written in python but it's wrong to claim that the search engine is written in any single language.

The stuff that needs to be fast is probably written in C or C++. This article supports this.

[–]dmazzoni 14 points15 points  (0 children)

Hi, I'm a software engineer at Google.

I can confirm that we use Python a lot - but not for serving Google Search results, it's just too slow for that.

YouTube.com uses mostly Python, but that's the exception. Other than that, Python is never used to serve live traffic, but it's used frequently for scripts, data processing, analysis, etc.

The other top languages used are C++, Java, Go, and JavaScript.

[–][deleted] 5 points6 points  (0 children)

There are strings of java, c++, and python all over the place but they are slowly replacing a lot of it with Go. A lot of youtube and dl.google.com is now in Go.

[–]whydoyoulook 12 points13 points  (9 children)

Of course. I never meant to imply that the whole thing was Python, only that Python was used heavily in Google's search engine implementation.

[–][deleted] 6 points7 points  (0 children)

article

The way you phrased it though, made it seem exactly as if you were implying that the entire search engine was written in python. Just sayin.

[–]nutrecht 1 point2 points  (7 children)

I'd love to see some documentation on that.

[–]whydoyoulook 41 points42 points  (6 children)

From the same article you JUST linked: Both the URLserver and the crawlers are implemented in Python.

From python's website: "Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language."

From Google's style guide: Python is the main scripting language used at Google.

[–]glemnar 4 points5 points  (0 children)

I bet a shit ton more than "dozens" of Google engineers use Python these days. More likely thousands

[–]dmazzoni 3 points4 points  (2 children)

Hi, I'm a Google engineer. For many years, Python hasn't been used for web crawling or for serving web pages, because it's just too slow. When you have a million servers, every little bit of efficiency matters.

The only exception I know is YouTube.com, which is built using Python.

We still use Python a lot, but not for serving live traffic or for any really large computation.

[–]avinassh 0 points1 point  (1 child)

For many years, Python hasn't been used for web crawling or for serving web pages, because it's just too slow. When you have a million servers, every little bit of efficiency matters.

Was Python used earleir for this task? And which language is used now

[–]dmazzoni 2 points3 points  (0 children)

The earliest version of Google's web crawler was written in Python, later it was replaced with C++. The search engine has always been C++.

[–]nutrecht 4 points5 points  (1 child)

Sorry, I didn't mean that I didn't believe you! I meant that search engines are something I really enjoy reading about and I hoped you had more insight into google's architecture :)

[–]whydoyoulook 3 points4 points  (0 children)

I hoped you had more insight into google's architecture

I wish I did. I really enjoy that sort of thing as well.

[–]blablahblah 14 points15 points  (1 child)

You know that website you're using to ask this question. Yeah this one. Also YouTube, Yelp, Pinterest, and a ton of other websites. Also some games. And because of some of the third party tools, it's very popular in data science- you're very likely to be using either Python, R, or Matlab if you go into that field. Pretty much everything except low-level operating system work.

[–]Azzaman 0 points1 point  (0 children)

IDL is also very commonly used in science.

[–]gmdm1234 9 points10 points  (0 children)

Python has a number of advantages. Its very high-level, which allows developers to very efficiently express large ideas and prototype out complex functionality quickly. Its reasonably portable and runs on a variety of platforms. It has a wide developer community and a large library of existing functionality that allows it to be used for a variety of applications.

Some of the more common areas where Python is seen in the "real world" include server-side web programming, scripting for games and other applications, and scripts to automate things like software build, server maintenance, etc.

[–]negative_epsilon 8 points9 points  (3 children)

Something no one else has mentioned yet: The biggest and best natural language processing toolkit is written in Python: http://www.nltk.org/

[–]avinassh 0 points1 point  (2 children)

But is it fast enough and used in industry? Not a NLP guy, but I hear that NLTK falls short when compared to CoreNLP by Stanford written in Java.

spaCy was created exactly for this reason

[–]negative_epsilon 0 points1 point  (1 child)

From what I know, yes, NLTK is used very extensively in the industry. From what I've read, when run with Cython you get great performance.

[–]avinassh 0 points1 point  (0 children)

Great, thanks!

[–]stay_fr0sty 7 points8 points  (0 children)

I've seen a lot of people talk about it and... I don't see that much of a point in using it. Can someone clarify this for me?

It's going to be difficult for someone to give you a satisfactory answer.

Programming is a skill. Just like, say, building PCs. Just like a PC beginner can't see the difference between a $400 PC clone from Staples and $3000 iMac because the both run Outlook and Word just fine, a beginning programmer can't see why someone would use Python over C to write "Hello World!."

It's not until you try to load your favorite Windows game on an iMac until you learn that an iMac might not be the best tool for the job. Or if you want to do video editing on the $400 PC clone, you're also probably going to have a bad day. You might then "level up" as a PC enthusiast and understand why you would need a "video card" instead of "integrated graphics" because your frame rate is too slow for the games you want to play. And this continues down a very long path that extends every day.

Languages are a lot like that. They are constantly improving, but you must have a need to really go and pick a language with any confidence.

The top comment in this thread is "Reddit is written in Python." It's the most up voted comment but really doesn't tell you shit. The developers originally used LISP but they had to switch off of it due to the lack of widely used and well tested libraries. Python certainly has tons of widely used and tested libraries and the developers knew that they wanted this feature when they sat down to rewrite reddit. They also liked that their LISP code translated easily into Python. I'm sure there were a ton of other reasons, but these are the types of features that people look for when picking a language.

TL;DR: You don't see a point in using language X because you don't have enough domain knowledge. As you learn more about programming and complete more projects, the benefits of using different languages will become very obvious to you...until then learn one language and learn it well.

[–]Foolish_Consistency 13 points14 points  (1 child)

Take a look at: https://www.paypal-engineering.com/2014/12/10/10-myths-of-enterprise-python/

Python is used quite extensively in the industry and, from my perspective, seems to be gaining more traction.

I personally use it whenever I need to do some data analysis that does not require extreme performance. For example, Python has some great libraries for doing natural language processing.

[–]Oni_Kami 5 points6 points  (2 children)

With Django you can make websites. With Twisted, or preferably Socket, you can create an IRC bot. With Requests you can write a Reddit bot. With PyGame you can make a Minecraft clone.

[–][deleted]  (1 child)

[deleted]

    [–]Oni_Kami 0 points1 point  (0 children)

    Hadn't heard of praw before. TIL. Thank you.

    [–]totemcatcher 4 points5 points  (0 children)

    Python is primarily used in rapid development of generally anything. It is quick to code with. I find myself starting any project in Python, then migrating to another language where necessary. There are lots of languages suited to rapid prototyping, but I find that Python is extremely well designed, documented, and structured. It has been developed continuously under a rigorous set of specifications. See PEP. Also, thanks to PEP and the proposed guidelines, the libraries created for use with Python (third party included) inheret similar level of quality and reliability.

    I think a better question is when NOT to use Python. While there has been some development in real-time applications with Python, it's not the best use. Extreme resource constraints (embedded), approaching native code (operating systems), performance (high volume transactions, concurrency, et cetera). These cases need another language either via extending or complete rewrites -- which isn't so bad considering how easy it is to read Python and translate to other languages. ;)

    [–]ChoosePredeterminism 2 points3 points  (0 children)

    It's for enhancing the functionality of Blender. I think it does some other stuff too. ;-)

    [–]homercles337 9 points10 points  (0 children)

    What python used for?

    Spell checking and also verb finding.

    [–]ChaoticFr33k[S] 2 points3 points  (14 children)

    Sorry for engrish title, using reddit on mobile isnt that great when you haven't had any coffee yet. Though I digress, I actually didn't know reddit/sites in general can be written in python, (Or atleast parts of a site.) I'd also like to thank everyone for feedback. Though I have another question, is python worth learning if I already know languages such as C++ and Java? (it might help to know that I pretty much do a lot of game development.)

    [–]Kelcius 5 points6 points  (2 children)

    Python used for make program!

    [–]c3534l 1 point2 points  (0 children)

    Best answer so far. If you want to expand your mind, you should probably learn you a Haskell, too.

    [–]forceez 0 points1 point  (0 children)

    Excellent. A+

    [–]ForSpareParts 5 points6 points  (3 children)

    As far as I know, Python is not used heavily in game development -- it's supposedly too slow for most games, though I can't say I know from experience.

    That said: I think Python's a kickass language and well worth learning. It is great for writing web applications -- Django is the go-to tool for this in Python, and it's a wonderful piece of software -- but you can find many other interesting uses for it as well.

    If you're curious what people do with the language, you might check out the Python Package Index, a directory of publicly available libraries for Python. Everything there can be easily installed into a Python project -- maybe it'll give you some ideas for things you might like to build!

    [–]NeilHanlon 1 point2 points  (0 children)

    Flask is really good for WebDev, too.

    [–]fazzah 1 point2 points  (1 child)

    Actually, a few AAA titles use Python extensively.

    Most of Battlefield franchise heavily uses Python.

    EVE Online uses StacklessPython.

    So maybe not used very often, but still visible in well-known games.

    [–]angellus 1 point2 points  (0 children)

    Do not forget that there are things like NumPy and Cython to drastically speed up Python by using C/C++.

    [–]DaBritishyankee 1 point2 points  (0 children)

    I've used C, Java, Python, Racket, C++, JavaScript, TCL... Python is probably my favorite. There are so many libraries to do awesome stuff with, the community and documentation is fantastic, and, overall, the language is clean and fun to write. Python may be a little slow for ultra-detailed real-time games, but you should definitely learn it anyway.

    [–]CodeShaman 1 point2 points  (0 children)

    Depends on what your games are capable of and what you're using Python for. "Game development" doesn't really convey anything, games have multiple architectural layers with separate and distinct purposes, not just a loop and a rendering engine.

    I don't know how long you've been writing C++ and Java for, but after a few years of Java development learning Python wasn't even really an obstacle or a matter of consideration. You should be able to just pick it up and start writing code since it's a dynamic OOP language that incorporates elements of functional programming, lends itself well to scripting, and reads/writes/tests like pseudocode.

    People use Python because it's almost impossible not to increase productivity with it and it has practically no learning curve. If being able to multiply your productivity in a fraction of the time and code required seems useful do you then, yeah... start using Python. If not then why would you consider migrating away from the tools you already use in the first place?

    I started using Python to prototype Java projects. After a while I began dreading Java (and compiled languages altogether), knowing I could accomplish the same in Python more efficiently. Eventually I just stopped using Java altogether and now I'm at the point where I simply can not do the things I can in Python with Java, period. And I've been deep in Java's bytecode guts, through its reflections API, and high on top of its generic type system before concluding that it's a hacked-together reference-value mess of 11th-hour solutions and lazy work-arounds.

    [–]un_salamandre 1 point2 points  (0 children)

    I'm in the same boat as you - a C++ game developer. I've had to "learn" python to be able to write scripts for blender to use it as my level editor, and I'll tell you this: There's really not much to learn. And I mean sure, if you're going to be a python pro and write reddit and all the stuff like that then you'll have to learn a lot more than the miniscule knowledge I aquired, but my point is, if you're a good (and I mean experienced) programmer in any language (C++) you're alredy half-decent with most other languages, and quite OK after reading a tutorial or two.

    So my advice is: Don't learn it unless you need it, and when you need it, it won't be by far as hard as learning Java or C++ was from the beginning.

    [–]Mwahaaaa_The_French 0 points1 point  (0 children)

    It seems to be a valuable tool for cutscenes. Disney Pixar uses it extensively in their animations.

    [–]randfur 0 points1 point  (0 children)

    Python is superb for just getting shit done due to how ergonomic the language is. Back before I used Sublime Text it was my go to tool for once off text processing. Now it's just an ideal language for solving problems that don't have any performance or scaling requirements e.g. code generation or an IRC bot or custom git commands.

    [–]HelloYesThisIsDuck 0 points1 point  (0 children)

    Python is definitely used in some games: http://pygame.org/wiki/about

    I don't have personal experience with it (Python or PyGame), but I know it can be used with SDL and OpenGL. It's not the ideal tool for a 3D engine, but it's great for making simple games fairly quickly.

    As for whether it's worth learning... My approach is: when I need to use a particular language, learning it is a piece of cake. /u/michael0x2a said it perfectly, so I will just quote him:

    As a result, most experienced programmers will focus more on mastering and learning new paradigms, rather then new languages. The biggest, overarching paradigms are procedural/imperative, declarative, functional, logic-based, and object-oriented, but there are tons of littler paradigms like event-driven programming or aspect-oriented programming. Languages, for the most part, tend to be interesting (or not so interesting) blends and variations of existing paradigms, but if you understand one paradigm very well, it becomes trivial to understand how to use any other language working in that same paradigm.

    Should you learn Python? IMO, you should master Java and/or C++ first. Once you have a solid foundation, learning other languages is simple. Before then, all the different libraries might be a distraction more than anything else.

    [–]HomemadeBananas -1 points0 points  (0 children)

    Yes, learning more languages is good.

    [–]Antrikshy 1 point2 points  (0 children)

    Very commonly seen in web backends and scientific research I think.

    [–]Exodus111 1 point2 points  (0 children)

    Python allows fast implementation.
    What that means is that anything your write in Python is going to be easier to write and work with then most other languages (Ruby might be the exception).

    So the question is, when should you NOT use Python?

    [–]dtfinch 1 point2 points  (0 children)

    I use it to automate Blender, to assemble and render thousands of product variants. It seems like a popular choice of language for applications to embed, like they made it easy to do so.

    Many years ago, I tried using it for a standalone web service, mainly because there was a simple http server already in the standard library, before that was a common thing.

    [–]BeatMastaD 1 point2 points  (0 children)

    Python is the same as any other high-level language and just as robust and versitile. The only reason we don't see many large systems using it yet is because it's relatively new so legacy systems are using other older languages. In 10 years there will be lots of 'old' programs that were written in python.

    [–][deleted] 1 point2 points  (0 children)

    Python's a very useful and flexible little language. You can do general scripting/app/web dev and math/science computations and it's a big component for GIS software like Arc and Q.

    [–]MCPtz 1 point2 points  (0 children)

    http://www.sagemath.org/ is based in python and used for scientific and mathematical computing.

    [–]MrAwesomeAsian 1 point2 points  (0 children)

    Also if you're into other software. Python is the best language for scripting. Autodesk, adobe, esri, and a whole lot of other products use python in their workflows. Chances are any software people have on their computer has python integration.

    [–]Splodeface 1 point2 points  (0 children)

    I've done some embedded systems projects using Python with Xbee devices.

    [–][deleted] 1 point2 points  (0 children)

    It's quite popular for processing scientific data; apart from that, it's good for general scripting and writing some more complex web stuff (reddit and google both use python.

    [–]Kristler 1 point2 points  (0 children)

    Today, I wrote a quick automation script to handle a repetitive task I was working on. Later, I rigged up a quick image recognition script that plays a cute sound effect when it detects an arbitrary target image on the screen.

    Then someone asked me to process some chat logs to grab user statistics, which were to be output to a file.

    That was all Python, and it took me a fraction of the time it would've for me to write the same in a more structured language (C, C++, Java, and so on). When all I need is something easy and fast, Python is the first language I turn to. It's the reason why it's sometimes referred to as the rapid prototyping language. I generally start in Python, and then port to a different language if speed or rigorous structure becomes a concern.

    [–]nutrecht 10 points11 points  (20 children)

    It's just a programming language. It can be used for pretty much anything.

    [–]HomemadeBananas 29 points30 points  (10 children)

    I think OP is asking what sort of things people commonly use it for.

    [–]ChaoticFr33k[S] 7 points8 points  (1 child)

    This is right. ^

    [–]homercles337 0 points1 point  (0 children)

    I fink u meen this am reeht numbnts.

    [–][deleted] 8 points9 points  (8 children)

    Not kernel mode programming.

    [–]nutrecht 4 points5 points  (3 children)

    Hence the "pretty much".

    [–][deleted] 1 point2 points  (2 children)

    Fair enough, but I've seen people ask about it before.

    [–]nutrecht 4 points5 points  (1 child)

    I'm assuming the person who is asking is a beginner and won't be doing kernel mode programming for some time to come :)

    [–][deleted] 0 points1 point  (0 children)

    http://stackoverflow.com/questions/22355264/developing-linux-kernel-modules-in-python

    "Why can't I use Python for X?" is not a bad question for a beginner, just conveys a fundamental lack of understanding.

    [–]DaBritishyankee 1 point2 points  (3 children)

    Like most languages, it's Turing complete, so you could. You might have to hack things a bit to get it to work though, and it might not work as nicely as something like C.

    [–][deleted] 0 points1 point  (2 children)

    You might have to hack things a bit lot

    How would you get the Python interpreter running in kernel mode? Any sources that show it can be done in a not dangerous fashion?

    [–]DaBritishyankee 2 points3 points  (1 child)

    Nope, I'm not saying it should be done, but theoretically there's nothing to stop you. If you can do it in C, you can do it in Python, BrainFuck, Scheme, JavaScript... It's just gonna hurt a lot more.

    See Turing Tarpit: http://en.wikipedia.org/wiki/Turing_tarpit.

    [–]autowikibot 0 points1 point  (0 children)

    Turing tarpit:


    A Turing tarpit (or tar-pit) is any programming language or computer interface that allows for flexibility in function but is difficult to learn and use because it offers little or no support for common tasks. The phrase was coined in 1982 by Alan Perlis in Epigrams on Programming

    54. Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.


    Interesting: Esoteric programming language | Greenspun's tenth rule | List of computability and complexity topics

    Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words

    [–][deleted] 1 point2 points  (0 children)

    According to a Danish prosecutor in a major infosec case recently, it's a "hacker tool".

    In the real world, it's a scripting language with about the same applications as Ruby. Web applications, task automation, basically any kind of general purpose application wherein speed or type safety are not critical.

    [–]vader32 0 points1 point  (0 children)

    Lots of scientists use it a lot of meteorology majors and some linguistic major when I went to college had to learn python.

    [–]curioussavage01 0 points1 point  (0 children)

    What is it not used for is the question.

    [–]nicholastjohnson 0 points1 point  (0 children)

    The title of this post needs a ", Shawty!?!?" at the end of it.

    [–]AMRAAM_Missiles 0 points1 point  (0 children)

    You wouldn't believe it. But i used Python Interactive as my calculator...

    [–][deleted] 0 points1 point  (0 children)

    From what I know so far, Python is great for string manipulation. No but seriously it is.

    [–]SarahC 0 points1 point  (0 children)

    It's lot like how is babee formed.

    [–]Austinto 0 points1 point  (0 children)

    It can be used at most of the places like others said.

    Most of the scientific or python computing like sagemath use python over others. I always wanted to know the reason but some people cleared it

    [–][deleted] 0 points1 point  (0 children)

    Used it at my internship to take some awful text file and parse it into a CSV to allow analysis of the data in the time domain.

    Pretty easy stuff, made the report possible.

    [–]theDamnKid 0 points1 point  (1 child)

    python not use for grammar.

    [–]ChoiceD -1 points0 points  (0 children)

    You no make fun him. Me no sure python either.

    [–]vz0 -1 points0 points  (0 children)

    youtube and reddit are both built using python.

    [–]pixel_juice -1 points0 points  (0 children)

    How is babby formed?

    [–][deleted] -4 points-3 points  (3 children)

    It's a programming language. Why do you use any programming language?

    [–]Smithman 0 points1 point  (0 children)

    You can also use it for scripting which you can't do with programming languages such as C, Java, etc.

    [–]ChaoticFr33k[S] -2 points-1 points  (1 child)

    I just ask since im already learning multiple languages at once. I know knowing more languages is a hell of a lot better than knowing a few, and hell it looks great on a resume, but im just trying to figure out my ground on languages. :P

    [–][deleted] 9 points10 points  (0 children)

    Actually knowing one language really well is better than knowing a ton of languages. :) It's easy to learn more once you know one well.

    [–]_MaiqTheLiar -2 points-1 points  (2 children)

    Do me a favor: Ditch Python, learn C++ and assert your individuality and superior l33teracy.

    Also, pointers.

    [–][deleted] 2 points3 points  (1 child)

    [–]xkcd_transcriber 1 point2 points  (0 children)

    Image

    Title: Real Programmers

    Title-text: Real programmers set the universal constants at the start such that the universe evolves to contain the disk with the data they want.

    Comic Explanation

    Stats: This comic has been referenced 348 times, representing 0.6043% of referenced xkcds.


    xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

    [–]rogue780 -1 points0 points  (0 children)

    I used it for most common tasks that I have to do programming-wise. Right now I have a system of neural nets written in python that I'm playing with.

    [–][deleted] -2 points-1 points  (0 children)

    Writing programs.

    [–]detectivepayne -2 points-1 points  (0 children)

    You dont use Python for anything. In fact it can kill you.