Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Macman1993

macrumors 6502
Original poster
Nov 23, 2007
337
16
I'm thinking of learning python but before I go out and get a book I just want to know what its primarily used for. So what is it primarily used for?
 
Its used to make web apps by people who think PERL is not verbose enough and ruby is a "toy" language.

Basically everyone has their own pet language and anything else is junk to them for any reason.

I use whatever language will get the job done, because in the end that's the whole point, accomplishing work of some sort.
 
Python, Ruby, Perl, and PHP all have pretty similar capabilities when you get down to it, so it's largely a matter of style. Python has a fairly clean and highly readable syntax IMO, and is concise while maintaining that readability. It has excellent string/text handling, and I like to use it for scripting jobs (batch processing filenames or text logs for example). With Django and/or Google's AppEngine, it's a pretty good alternative to Ruby+Rails for running database-aware server-side web applications too.
 
  • Like
Reactions: D.T.
My recommendation: go for it

Learning python certainly won't hurt. In my opinion, the more programming languages you learn, the more flexible your mind becomes about programming and it's easier to learn new languages. The only problem is you can start mixing syntax or semantics--eg I sometimes need a reminder if I should use 'eq' or '==' compare strings, or concatenate strings with '+', '.' or '&', or forget if short-circuit boolean operators return the argument value (as in Perl, JS or Python) or cast the value to boolean (like in PHP, C).

If you're looking for a language to help you learn programming, Python is a fine choice.

If you're worried about the investment of time and money, start with the official Python tutorial.
 
Blender, Gimp, Linux, finances, security

More uses: plugins for (eg) Blender and GIMP, though you can also write GIMP plug-ins in Scheme, Perl and C/C++. Some linux distros use Python for installation & administration tools. Red Hat, I believe, makes extensive use. A friend of mine uses Python for bulk data translation & transfer at financial institutions. Finally, it's also used for IT security analysis.

Like Algol, Fortran, C, C++, Java, Tcl/Tk, Smalltalk and VB, Python doesn't seem to have a primary use. I'm should probably include C# and ObjC in the list, but you could argue their primary usage is for Win32 and Mac programming, respectively.

Edit: old thread, but here's a new use: controlling 15 ton robotic grapples (wiimote optional).
 
Thanks for all the input guys. Today I ordered the book "Python Programming For The Absolute Beginner" so now I can start programing which is something I have wanted to do for a while.
 
I started writing about this at length yesterday, but gave up because I was rambling. I'll try to be more concise.

Python is used for programming. Every turing-complete (maybe I should say general purpose, due to a lack of infinite tape, but w/ virtual memory, local disk, network storage, and internet storage we have a practically infinite tape) language can accomplish the same task. The differences really come from:
Clarity of Syntax
Memory Management
Libraries available
APIs available

If you want to write a web server in python, you certainly can. If you want to write web application, it seems like there are already libraries/frameworks in place to make this easy. If you want to script things, have at it. Write a client side business application? Sure, as long as you can bind to the GUI underpinnings of the targeted OS.

One thing that seems to shape common uses of a language is whether the language is compiled or interpreted (or always compiled at runtime). Languages that are interpreted or compiled at runtime like Perl and Python seem to be very popular for scripting, possibly because of the write-compile-run-debug cycle having a step removed. This is of course not always the case. Where I work, we have a very large web-based application that uses Perl for the dynamic HTML generation and API layer.

The times when language really matter are when you must use a particular API for a particular task. You can always make wrappers, but you'll have to write some code to interface with the API that you then wrap in something else. An example is Objective-C, and the Cocoa API.

Good luck. I'm not familiar with Python but if you can, try to learn the basics before you dive headlong into Object-Orientation.

-Lee
 
I'm a big fan of Python, because I've found it to be so versatile. I've written web applications, CLI scripts and desktop applications using it, and every time found it to be an easy yet powerful language to program in.

I'm currently learning the Python bindings for Cocoa, and I've been writing some tutorials/how-tos as I go, because the documentation for it is close to non-existent.
 
Eric Raymond in 'The Art of UNIX Programming', available online for free, has an appraisal of Python (alongside appraisals of C, C++, Perl, Java, etc). He also cites case studies of projects written in *x* language.

I'd take his C++ assessment with a grain of salt.
 
The one thing I didn't really see mentioned is that Python has a lot of packages that you can easily download which allow you to do anything. Python is very useful for processing textual data for natural language processing. Another good example is for Machine Learning. There are numerous packages for machine learning that you would be hard pressed to find for other languages.
 
I know a lot of researchers who use Python to process text and analyze data, often before or in combination with R. Many of them used Perl for this purpose in the past (and some still do).
 
Python is not only used for professional web development, but seems to have taken the place of Basic, Forth, MUMPS, and other interpretive languages used by non-professional-programmers to learn and script various science and learning activities. Python seems to be used a lot for university level courses in big data and machine learning courses; in scripting educational experiments using Raspberry Pi's; as well in a few books for teaching young kids how to code. There's even an embedded version for (relatively) tiny microcontrollers.

Python sees quite a wide range of popular uses these days, putting it at #5 to #6 on the TIOBE index of computer language popularity, currently well above Objective C and Swift.
 
Hard to believe people don't check to see how dated a thread is.

But a few nice comments on the merits of the language.

I picked up myself several years ago (pre-retirement) for a couple of "plumbing" projects at work.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.