This isn't really a question that I have. I just thought that it would be an interesting subject to talk about.
Python - a language you would use to develop a complex program or just a really nice scripting language.
Realistically I can not see myself using Python to solve complex problems. But what I do see myself using python for is to rapidly build small to medium sized prototypes or mini-projects. A quick proof of concept if you will. If I have an idea about a widget I want to build and want to build a quick dirty model or prototype of my ideas python is a good fit for that. At a high level I can use Python to see how different classes (or objects) might work together without implementing all the gory details under the hood. Perfect for a visual learner like myself. This does not get rid of the need to diagram my ideas out on paper (uml or otherwise) but I like to think of it as more fun way to map out my ideas using Python. Just my 2 cents. What do you think?
There are quite a lot of old wisdom banging around here. Some of it is older than it is usable :-D I'll add my 5 cents.
All computer languages are equal, since they are all Turing-complete
True, but irrelevant. The ultimate version of this is: In the end, all code you're writing will be run by the processor in your computer. It talks in a machine language that consists mainly of moving numbers about, basic arithmetic, testing for a few numeric conditions and jumping about. Thus, every program can be written in machine language. We don't do that, though, because expressing the kind of programming ideas we want is damn hard in the frugal environment of pure machine code. What matters is the expressivity of the language, not its turing-completeness. What kind of code is easy to write in the language?
The canonical reference here is Paul Grahams Beating the averages, where he is talking about building production code in another "Too theoretical, too slow, too highlevel" language - Common Lisp.
Python is too slow, because it is interpreted
This is also half-true at best. The standard way of developing in Python is to do it in the interactive, interpreted environment. This is for good reasons - This kind of incremental development environment is very effective in the speed of the write-test-debug-cycle and the in-place testing. However, there is nothing that stops you from compiling the finished code with something like Cython when it is time for release, adding things like type hints and so on to increase effectiveness. There are tools like PyChecker that you would use to go through the code and warn for potential problems. It is just that these are not forced upon you from the start.
Java, by the way, is an interpreted language in exactly the same way as Python is. I do believe that it is used in one or another big system.
Python can do everything that any other language can do
Not true, either. In Python, we have a lot of very powerful constructs on the high-level-end: mapping over sequences, list comprehensions, a dynamic object model. On the other hand, we are lacking stuff at the low-level end - If we want to bang hard on memory adresses or control the storage models for our complex numbers, we cant. Python is a fairly unashamed highlevel language. If you want to do lowlevel stuff stuff, use a lowlevel language like C.
(This taps into another misunderstanding: A highlevel language is better than a lowlevel language, because it is highlevel - Not so. High and low level are in relation to how far the language is from the "metal" of the computer. It expresses its concepts on a different abstraction level.)
However: From Python, you can easily call procedures and functions written in C, for instance (and many other languages). So, if you need to get lowlevel stuff done, you write it in C. Then you want to do advanced operations on the data you send to the lowlevel procedures. Those bits you write in Python.
So, what is the answer, then
The answer is that the question is broken. Or, rather, the question is the headline is simple to answer: Yes, Python is a lot more than a scripting and prototyping language. The related question "Would you use Python for a largescale commercial project?" however, is wrong. The proper question would be "Where, in a large-scale, complex commercial project would you be able to use python?" And there, the answer would be "In the high-level parts of it, where we need to do complex manipulations on intricate data structures, or use flexible generic procedures on varying data sets." Would you write an OS in Python? No, but I'd write a computer music system, or a big CRPG, or the user interface of a big database application. I'd farm away the low-level audio and graphics stuff (that is, audio buffering, triangle rendering and so on) to a lowlevel language that does that better, though.
So, why isn't everyone using Python, then?
Well, that one is easy. As Paul Graham points out - If everyone knew what they were doing, everyone would be using LISP :-) But they don't. Large scale projects are handled by politics and management, and management reads stuff they understand, where words like "Market share" and "Brand visibility" is important. From that, they learn that Microsoft is important, that everyone is using Visual Dot Net Letter-of-the-month-#, and so that is what must be used in the project, top to bottom. A few years back, it was Java, and a few years before that, it was C++. A lot of years back, it was COBOL.
Would you, or could you, use Python in a big commercial project? Sure you could - As you could with almost any language, as long as it allows you to express the kind of data structures and manipulation that you need. Would you use it as the single language? Depends on the project, of course - The user part of a big database application thing could without problem be only Python. Should I learn only Python and use it for everything? No. If you want to be a proficient programmer, you should at least have a lowlevel language such as C under your belt, too. If you want to work at a specific place, you need to know the language used there - If you're going to do major iOS work, you'll want Objective C. This, however, is no reflection on whether one language or another is more suitable in itself for a particular style or scale of project, but has everything to do with the corporate culture and politics of the place you're going to work at.
Are you wasting your time learning Python? No. Every programming language you learns adds concepts and patterns to your repertoire, and allows you new and different ways to think about a problem. When you've learned about Pythons list comprehensions, you'll know about those as an elegant way of solving certain problems. Then, you might get stuck on an only-C project. Still, when you see the problem that you're up against, and realise that you could solve it easily using list comprehensions, then you can quickly code up a simulation of them in C, and use that to solve the problem.
Every language gives you tools. Every language allows you to use them with more or less difficulty. Every language is useful.
Are you bored yet? :-)
answered 16 Mar '12, 05:45
Python is as capable as any language out there. If something can be done in another language, it can be done in Python.
There are many considerations that go into choosing a language, but the perception that python is only a "scripting" language, or only suitable for small projects, or prototyping, or that it lacks the power or versatily to do what language x can do, is not correct.
answered 15 Mar '12, 18:10
Rob Barnes-3 ♦
jksdrum, don't get snookered into this vestigial stigma of Python not being suited for large-scale projects.
Exactly because Python's level of abstraction is so much higher than the conventional "Enterprise" languages,
In addition to that, Python - and it's habitat - will teach you good engineering practices.
I'm a Ruby, Scala and C person generally, so I'm not touting Python's virtues out of religious motivations (i think) ;)
answered 15 Mar '12, 23:34
It can and is used for large scale projects. I've personally been involved only up to medium scale web applications, one of which was used 24/7 to handle legal requests for information (can't say much more than that on that one). A colleague of mine worked for PIMCO for sometime and though I don't know for sure but I'm guessing they were working on decent sized projects. Heck I get the vibe that some of the people responsible for udacity are googlers and there's mad love for Python there. I'm sure they've done some substantial work with it.
Hopefully mathprof finds this thread because he might have some specific examples.
answered 15 Mar '12, 18:11
Depends on what you call a "complex problem". Python is by itself not suitable for writing heavy-weight programs because it will not be able to run fast enough. However, with the right libraries backing it it can be used to make some impressive things that work at a decent speed (such as Anki), and if you talk about "problems" in general, as opposed to "programming problems", you'll find plenty of uses (see SciPy, Sage, etc.). It isn't good raw material, but it is wonderful glue.
answered 15 Mar '12, 18:35
Anton Golov ♦
Guido van Rossum (the creator of Python - http://en.wikipedia.org/wiki/Guido_van_Rossum) has just addressed this question in an interview:
"Van Rossum: What people of course do is they pick a tool and they build something incredible, and as part of the incredible thing they're building, they're doing crazy stuff, and sometimes some of the crazy stuff involves doing a whole bunch of computation, crawling through a graph of a billion social contacts or analyzing a trillion email messages or whatever.
At some point, you end up with one little piece of your system, as a whole, where you end up spending all your time. If you write that just as a sort of simple-minded Python loop, at some point you will see that that is the bottleneck in your system. It is usually much more effective to take that one piece and replace that one function or module with a little bit of code you wrote in C or C++ rather than rewriting your entire system in a faster language, because for most of what you're doing, the speed of the language is irrelevant."
Update: More commentary on Linux Weekly News: https://lwn.net/Articles/486908/
Go is kind of like a mix of C and Python if you care more about performance.
Here's an interesting anecdote:
Here's an interactive go compiler, kind of like the one used for the Udacity class:
(see also http://golang.org/)
I have really enjoyed seeing both sides of the coin. Thanks to all who have contributed their experiences/opinions.
I talked with one of the SW architects at the company I work for and this is what our team uses Python for:
Eve Online is an MMORPG that uses stackless python for its client and server software, that's a pretty huge and complex database system. Python also is the language used for Dropbox client and server, and backends for things GMail, Google Maps. It's heavily used in web programming I'm pretty sure.
It may not make sense to write a given product completely in Python, but it certainly has a lot of uses.
answered 16 Mar '12, 20:16
Learn python, youre life as a programmer will be so much easier.
answered 17 Mar '12, 00:35