View Full Version : Question for Python gurus
Dru Lee Parsec
03-06-2002, 04:11 PM
OK, I've looked at python.org and Jython.org and I've discovered that Jython is simply the Python language implemented via the Java Virtual Machine.
OK, so Now I'm looking at Python as a language ane I've read the basic tutorial and it looks pretty easy.
So my next question is: "What types of problems does Python excel at solving?" So far it looks like a lot of other languages. I'm sure I havn't researched the language enough to see it's benefits yet (and I have too much work today to be fooling around anyway ;-) ) So what would you use Python for that you wouldn't use something else?
Thanks
GnuVince
03-07-2002, 12:04 AM
Hey Dru, nice to see you again. About your question, Python is pretty much an all purpose language. I like to use it to do simple programs, networking programs, string manipulation is fun to do too. You can also have more power shell scripts.
People who use Python:
- Google for its search engine
- Industrial Lights & Magic for general purpose
- RedHat: Red Hat Linux install program
- NASA
Python is also good if you want to do something really fast. It is in my opinion one of the most natural language to code in, most everything makes sense.
Just learn it, and I'm sure that with your experience, you will see where it could help you
G'night man.
Dru Lee Parsec
03-07-2002, 01:52 PM
It also seems that there are a lot of libraries available. Didn't KMJ (or somebody on this board) just write a 3 line MP3 Player?
I think for my needs I'm fluent enough in Java that I can knock out general purpose programs in that language. I was just wondering if Python had a core strength that made it more appropriate for certain task.
But I must admit that it looks easy to read. I bet for people learning to program it bypasses a lot of the barriers to learning that other languages have.
Ya know, In college they use to teach Pascal as the learning language and then "upgrade" the students to C, C++ or Java. I bet that these days Python could (and probably should) replace Pascal as the teaching language because you can actually use Python in the real world whereas nobody I know of still uses Pascal. (I Know Intuit use to, but I'm not sure if they do any more).
OK, Once I get some spare time I'm going to try to write a "Hunt The Wumpus" program in Python. :)
GnuVince
03-07-2002, 02:33 PM
Yup! Python has a lot of libraries. I'm actually writing a more complete mp3 player (it should be finished this Friday). And yes, learning with Python is great. It feels like it was designed (and it was), not add-ons over add-ons à la Perl.
Dru Lee Parsec
03-07-2002, 05:15 PM
not add-ons over add-ons à la Perl.
LOL. I'm reminded of a saying that Perl pros use.
TMTOWTDI
"There's More Than One Way To Do It." Even the Perl experts realize (and some time revel in) that Perl has it's complexities.
:)
Yeah, in python, I think they say "There's only one way to do it; the right way." or something like that. :)
I believe python was originally intended as a learning language, and it's being used for teaching in many places right now. (As evidenced by the like I posted, How To Think Like a Computer Scientist, in a different thread here.) But it is being used plenty in industry, and it's popularity is growing.
I love it because it is just so clean. It is just plain fun to write code in python. One thing you have to get used to is the dynamic nature of python, and learn to see it as a tool, not something you need to be protected from.
*bump*
ever do that hunt the wumpus, dru?
Strike
06-07-2002, 12:45 PM
Sidebar: there are plenty of ways of doing things in Python. But, to do one specific operation, there is generally only one way that is accepted, but that doesn't mean there aren't more ways of doing it. For example, when I first started Python (from a C/C++/Java background mostly), I would iterate over lists with something like:
for i in range(0, len(listname)):
print listname[i]
Which, to a veteran coder, isn't incredibly cryptic. But, there are better ways, which are even easier to read for non-coders:
for item in itemlist:
print item
Also, taking advantage of the OO nature of Python took me a while at first. Being able to do things like:
privilege = args["text"].split()[2]
(although this is generally not a good thing to do) were new and weird to me. The idea that each function returned an object that could simply have another method/operator appended to it that would act on that returned object was weird, especially because the OO stuff isn't as explicit as it is in other languages.
Anyway, yeah, Python's good for just about anything that doesn't require real-time performance, basically. It's got a clean syntax with powerful library support (even more so with Jython).
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.