# Is Python more than a scripting/prototyping language? Discuss.

 1 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. Discuss. 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? asked 15 Mar '12, 18:02 jksdrum 3.6k●10●20●58 accept rate: 18%

 5 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 ♦ 19.3k●10●68●205 I was not saying you couldn't use Python to do any project imaginable. I am not knowledgeable about Java. But dare I say that Python could be, maybe already is, a major competitor to Java. Both require "interpreters" (Java uses JVM). @dshmif already showed me a way to convert python programs to an installable windows app: dshmif post re: py2exe (15 Mar '12, 18:31) jksdrum 1 Not only can you dare to say...feel free to say it. I will tell you point blank that the group I worked with HATED having to go to Java. The productivity gains when using Python are truly great and at least in the web application space frameworks such as django really give Python some firepower. Again it's tough to argue against the productivity that Python provides. However for the Enterprise space I'm sure there will always be a need for Java. For some reason, at least in my experience, Python is looked at as a toy language (ridiculous) and as I've mentioned in another thread managements perceived ability to obtain resources easily to handle ramp up and turn over plays a roll in these things. (15 Mar '12, 18:43) David Smith This isn't true. There's a bunch of things you can do in some languages that you really can't do in Python without libraries (and even with libraries: try accessing your processor's flags register). The point is that it isn't a matter of big project vs little project, but of what you want to express with it. (15 Mar '12, 19:48) Anton Golov ♦ 1 Indeed...one of the tools in a toolbox that's it...just another tool. (15 Mar '12, 21:00) David Smith @jesyspa you miss his point. You can get the same operations done with Python as you could with any language that could operate on the processor's flags register. As is pointed out in Unit 1 Python is just as Turing Complete as any other language out there. (15 Mar '12, 23:58) Thomas Bartels @tbartels: Sure. So is brainfuck. However, nobody is going to claim you can do everything in brainfuck that you can in another language, because you can't -- the language simply doesn't provide networking capabilities, and you're not going to get around that without changing it fundamentally. Similarly, writing certain programs in Python is not possible, either due to the language providing no support for it, or the current implementations not offering it. (16 Mar '12, 04:31) Anton Golov ♦ Neither Python nor C can access the processor flag register without an assembler library or a device driver. (unless you are on an embedded processor and the flag register is memory mapped). I use python to control hardware registers in my daily work - and much easier than the corresponding C/C++ code. (16 Mar '12, 16:23) George Bullis-1 @GeorgeBullis: C and C++ have inline assembly as a fairly common feature (although it is not particularly convenient, as far as I've seen). How do you access the registers? Googling gives this, which doesn't seem very affirmative. (16 Mar '12, 16:32) Anton Golov ♦ @jesyspa -For my register access, I use a home grown version of the PortIO library (like the one you found) that accesses our custom hardware via our custom device driver. www.SWIG.org is an invaluable tool for taking a DLL or .so (shared library) and wrapping it for python access. (17 Mar '12, 00:31) George Bullis-1 ...which is exactly what I said above, isn't it? Taking some low level code and calling it from Python? (17 Mar '12, 15:11) JohanG-Sweden
 3 jksdrum, don't get snookered into this vestigial stigma of Python not being suited for large-scale projects. With all humility, folks who shrug off Python as, somehow, inadequate are laggards from the past, when hardware was painfully slow. Exactly because Python's level of abstraction is so much higher than the conventional "Enterprise" languages, it is very well suited for large-scale development. It supports multiple paradigms and nimble tools that the "big" languages can't catch up to for the past 15 years. 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) ;) Cheers. answered 15 Mar '12, 23:34 Eli Burmin 2.3k●1●2●29
 2 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 David Smith 1.2k●6●12●36
 2 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 ♦ 13.6k●21●75●174 I like your use of the word "glue". I read somewhere else that Python is heavily used as glue code between modules. I'll say one thing about python it is so much easier to type than other languages (I'm referring to C++ and the like). (15 Mar '12, 18:41) jksdrum @jksdrum: And read. And test. And (thus) maintain. And I think getting the AST and doing awesome things with that is quite doable, too. (15 Mar '12, 18:44) Anton Golov ♦ AST? Help a n00b out. (15 Mar '12, 18:47) jksdrum @jksdrum: Abstract syntax tree. Well, I mean the parse tree, really. The code, but represented in the form of a tree, so that it's easy to manipulate. (15 Mar '12, 19:03) Anton Golov ♦ Thanks @jesyspa. So this question is coming out of left field but here it goes.... My first exposure to programming was the c language followed up by c++. The world of int's and char[]'s was fairly straightforward to understand. Is python, and other higher level languages, really just making clever use of pointers in essence abstracting away the data just one more level? Because everything is an object in python. (15 Mar '12, 19:11) jksdrum @jksdrum: Python and other high level languages make use of a lot of things to abstract things away. Pointers are important (although I think it's just because shallow copying everything by default is simpler that they do that); however, there's also all kinds of syntactic sugar that isn't present even in C++, such as list comprehensions and inline tuple creation. On the other hand, you've also got the power of the language being dynamic, and therefore being able to change things that would usually be compile-time at run-time. Class definitions are a great example of this: you can dynamically select what you want your class to inherit from, or what functions it should have. (15 Mar '12, 19:51) Anton Golov ♦ 2 C is easy to write for certain coding approaches and somewhat harder to write for others. Pointers are easy to code, but also easy to screw up. I've written a lot of object-oriented code in C. It's "supported," but not enforced or made easy. If you want readable, type-checked and range-checked code, you soon start adding "syntactic sugar" via macros or carefully named function calls. Bjarne Stroustrup said, "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." My limited exposure to Python leads me to believe that its strength comes from natural, almost-English expression of coding intentions. You write code to be the way you'd like it read back to you. This was tried at least once before, with COBOL, but we understand general-purpose computing much better now. (COBOL reads like instructions to a filing clerk: "add a to b and store the result in c." I heard [then Capt.] Grace Hopper say this was so supervisors could read the code. She also said the design was a mistake; supervisors don't read code.) I'm sure there is power in Python that we haven't yet encountered, for functional programming, error handling, recursion, and a lot more. It's impressive when multiple styles are well supported in a single language. (15 Mar '12, 20:06) Kenneth I. L... Sorry to beat a dead horse... I did not phrase my initial question well: Is python, and other higher level languages, really just making clever use of pointers in essence abstracting away the data just one more level? Because everything is an object in python. Let's analyze a concrete example: Python has a list type. It can append anything you want: strings, numbers, other objects. If I initialize a list like this: list = ['text',6,'more text'] It is clear that the list contains a string, a number, and another string. What isn't clear is what is going on "under the hood". My guess is if you were to look into memory the python list is actually just a linked list. And each node in the list is a pointer to an object. For example, list[0] holds the string 'text'. But under the hood list[0] contains a pointer to a string object somewhere else in memory. Likewise list[1] holds the integer 6. But under the hood list[1] contains a pointer to an integer object somewhere else in memory. Is this even close to being correct?? Or am I wrong in thinking of the Python language in c/c++-like terms? (15 Mar '12, 20:27) jksdrum 1 You are wrong in thinking of the Python language in C++ terms, or are at least thinking in the wrong terms. Python is a language, not an implementation. Mapping Python to C++ when writing it is like mapping C++ to assembly: useful in a few cases, but only applicable to one implementation, and unlikely to improve your understanding. First and foremost, think about semantics, then think about how it will be executed if you need to. A list may be a linked list. I doubt it -- I think something along the lines of a C++ vector is more likely. However, once you start talking about that, you are no longer talking about Python; you're talking about CPython, or PyPy, or IronPython. Those three may do it in completely different ways, and you should focus on one if you want to understand these things. For example, CPython will first compile your code down into bytecode, and then interpret that instead of the original code. Therefore, there's actually two mappings you should be looking at: Python code to (optimised) bytecode, and bytecode to instructions. I do advise looking at the bytecode, it's an interesting thing to see, but it's no t necessary for writing Python code. One exception to this is knowing the complexity of operations on different types: if lists were indeed represented as linked lists, then random access would be awfully slow, and therefore it would pay off to avoid it. I doubt this is the case; on the other hand, you may want to know that strings are immutable, and that this can lead to concatenation being more expensive. In brief, make sure you know the difference between a language and an implementation, and look things up if you want to make a mapping to another system. (15 Mar '12, 20:40) Anton Golov ♦
 2 Guido van Rossum (the creator of Python - http://en.wikipedia.org/wiki/Guido_van_Rossum) has just addressed this question in an interview: http://developers.slashdot.org/story/12/03/16/1947252/van-rossum-python-not-too-slow "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/ answered 16 Mar '12, 17:26 Karl J. Smith 842●2●5●16 1 "for most of what you're doing, the speed of the language is irrelevant" Agreed. Take our webcrawler for example. Network delays far outweigh string processing delays or list parsing delays. If and when those delays do become critical path re-write those parts using c/c++. (16 Mar '12, 17:44) jksdrum
 1 Go is kind of like a mix of C and Python if you care more about performance. Here's an interesting anecdote: http://blog.golang.org/2011/12/from-zero-to-go-launching-on-google.html Here's an interactive go compiler, kind of like the one used for the Udacity class: http://tour.golang.org/#1 (see also http://golang.org/) answered 15 Mar '12, 18:07 Karl J. Smith 842●2●5●16
 1 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: parsing API messages on a server accessing Compact Flash Internal test harnesses Code generation during the Build for client api Help file generation for APIs answered 16 Mar '12, 15:56 jksdrum 3.6k●10●20●58
 1 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 curiousborg 674●2●10●31
 1 Learn python, youre life as a programmer will be so much easier. answered 17 Mar '12, 00:35 MathGuru 285●1●1●9
Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×27,753
×2,190
×38
×1