PDA

View Full Version : Python Advocacy


sheila
03-20-2001, 01:35 AM
Just a few (?) nice words about the Python programming language:

(1) It's easy to learn. Experienced programmers can probably sit down with the Tutorial[nbsp][nbsp] and learn it in an afternoon. But even people with no programming experience seem to learn Python easily. (Here's a testimonial from my AP Computer Science Teacher's mailing list: --URL removed-- the archive is now password protected. However, I have snippets of the testimonial in some of the messages down below... ) If anyone is interested in pointers to links for non-programmers to learn Python, let me know.

(2) Cross-platform. Runs on Windows, Unices, OS/2, Mac, and any platform that has a C compiler.

(3) Comes with many modules that make it EASY to write Internet applications, cgi scripts and more.

(4) For people into GUI program, there are many GUI toolkits for Python.

(5) It's free and open source.

(6) It's extensible. You can write your own C modules to extend the language.

(7) It's scalable. It is appropriate for writing little scripts, and for writing full blown applications.

(8) It is widely used in industry.

I posted some other comments in this thread:
http://www.aota.net/ubb/Forum3/HTML/001564-1.html

For those who need convincing, what convinced me was the personal testimony on this page:
http://pantheon.yale.edu/~pmm34/programming.html

<oops! C++ != C >
[This message has been edited by sheila (edited 03-31-01@7:45 pm)]

sheila
03-20-2001, 01:38 AM
OK, and now for[nbsp][nbsp]a much longer post about Python:

In this thread:
http://www.aota.net/ubb/Forum3/HTML/001564-1.html
<begin edit>
Terra originally wrote:
I think the main problem is that no one really uses Python that much in a production environment


then he later revised/clarified it to:

I think the main problem is that no one really uses Python that much in a production environment on the FutureQuest servers...[nbsp][nbsp]This would sort of place you on an island with seeking help with development issues from the FutureQuest Community...

My comments that follow were in response to his original comment, but don't let that detract from the message. Python is still a nice little language, worth checking out.
</end edit>

Whoa, ho! Let me put on my Python Evangelist hat...ok, there.

The following snippets can be found in the Tutor Archive, March 2001, under the subject: Real World Python


I was reading
the latest gaming column at ArsTechnica
(<http://arstechnica.com/etc/games/>), and at the bottom of the column, they have their weekly cheat codes. This week, it's for a game called &quot;Blade of Darkness&quot;.[nbsp][nbsp]They tell you to enable the codes, you have to make changes to your menu.py file.[nbsp][nbsp]&quot;.py!?![nbsp][nbsp]Hey!&quot;. I thought, &quot;They're using Python to configure this game!


More real-world examples:
- -Mailman (excelent mailing list manager, used for example at python.org and
freebsd.org)
- -blender: 3d modeler that uses python as an extension languaje


One of my favorite &quot;gee I wish I'd written that&quot; examples: kivio, a visio
clone:

http://www.thekompany.com/projects/kivio/


I'm no winblows user, but we have NT in the lab.[nbsp][nbsp]It's hard to get services (FTPD, Web server) running, especially if you don't have the service CD.

A few months ago, I wrote a cross-platform FTPD in python.[nbsp][nbsp]I haven't
really tested it heavily, but it works for the most part.[nbsp][nbsp]I did a
complete copy of a directory tree from a Win98 box to a WinNT (running
my ftpd.py).

This is all to set up a demo for our CEO where two web clients (WinXX)
talk to a web server (WinNT), which is really SimpleHTTPServer.py,
communicating through our networking prototype.

In other areas, I wrote a fair portion of some system level bits of our
product in Python; things like booting, upgrade, system management.


Another Real World Python example is in the field of engineering.[nbsp][nbsp]ABAQUS (a nonlinear finite element analysis package) uses Python as its scripting language.[nbsp][nbsp]I'm told they also develop their GUI's in Python for
portability.[nbsp][nbsp]Best of all, they provide Python API's to their code, so I
can interface with their databases in Python.

quoted from http://www.python.org/psa/Commercial.html

We took all this into consideration when NASA decided to standardize on Python as its scripting language of choice for the Integrated Planning System last year. I lobbied hard to get NASA to realize how much money was being wasted with all these engineers going off and programming in whatever language they knew. This had created a hodge-podge of C shell, Bourne and Korn shell, PERL, awk, sed scripts as well as Fortran and C programs, used in inappropriate ways. Code was understood only by its author and reuse was made impossible. With Python we are able to build libraries of reusable modules and use the power of object oriented programming to rapidly write applications. In the case where heavy number crunching is required we rely on
Python's excellent C/C++ extension facility to call compiled code. We are also placing Python in the new Mission Control Center
here in Houston where it will be used to augment the analytical GUI's we've written. Obviously with manned space flight, people
are very sensitive to code reliability. Python has demonstrated good reliability as full exception handling is build into the language
(and we use it). Other people have requested PERL, tcl, even Java to be made available for MCC applications, but only Python has
been approved.

Other places that Python is being used:

Poser 3D modeling software uses Python as a scripting language.
http://www.curiouslabs.com/products/proPack/python/index.html

List of companies/projects using Python (note, especially, Yahoo and eGroups--well former eGroups)
http://www.python.org/psa/Users.html

Webservers written in Python:

Medusa: an Internet server framework:
http://www.nightmare.com/medusa/

Zope
http://www.zope.org/

Who uses Zope?
http://www.zope.org/WhatIsZope

Python propaganda and articles:

Disney chooses Python to help script their animation:
http://python.oreilly.com/news/disney_0201.html

The O'Reilly Python Dev Center:
http://www.oreillynet.com/python/

First Chapter from the book &quot;Internet Programming with Python&quot;
(Discusses many uses of Python):
http://www.fsbassociates.com/books/pythonchpt1.htm

An article that is an interview with the language author, discussing &quot;Perl programmers moving to Python&quot;
http://searchenterpriselinux.techtarget.com/searchEnterpriseLinux_Q_A_Page/0,285144,531191,00.html

The above article gets slashdotted:
http://slashdot.org/articles/01/03/16/0349216.shtml

The Who, What, Where of Python:
http://www.networkcomputing.com/unixworld/tutorial/005/005.html

Well, I'll stop there for now.


[This message has been edited by sheila (edited 03-20-01@02:46 am)]

Terra
03-20-2001, 02:52 AM
Whoops, my bad - let me edit my post to clarify...

Sorry for the confusion...

--
Terra
--redefine--
FutureQuest

Terra
03-20-2001, 03:01 AM
Done - pls edit/update your post to correctly reflect my intended verbiage...

The 'production environment' was written with context to FutureQuest servers and Community...[nbsp][nbsp]But I can see how one could be oblivious to the context and take the words at raw value...

I have made an attempt to clarify my statement so that the context is very much pronounced and practically unavoidable...

--
Terra
--VI or EMACS or UltraEdit, it's just a bomb waiting to go b00m--
FutureQuest

sheila
03-20-2001, 03:52 AM
But I[nbsp][nbsp]can see how one could be oblivious to the context

Oblivious? That' a bit harsh.


I have made an attempt to clarify my statement so that the context is very much pronounced and[nbsp][nbsp]practically unavoidable...

Well, maybe it is just the math teacher in me. I tend to read what is written.

mike_w
03-20-2001, 02:54 PM
Ok Sheila, all this talk about Python has made me order a copy of the 2nd edition of Programming Python. I'm never going to have a life away from this computer. I hope your happy now ;)[nbsp]

sheila
03-21-2001, 01:28 AM
Hi Mike!

I just ordered 2nd ed of Programming Python myself, last night. I also have Core Python Programming by Wesley Chun, which is pretty good. I canceled my backordered Quick Python, because (1) I'm tired of waiting for it (over 2 weeks), and (2) I think I'm a bit past that beginner stuff, now.[nbsp][nbsp] (Python bookstore: http://www.amk.ca/bookstore/ )

Do you program?

And no use blaming me for your computer addictions. You know full well, that if you hadn't decided to give Python a look, you'd have been trying something else like PHP or SQL or what-have-you.

While you're waiting for your book to arrive, you should install Python on your local machine: http://www.python.org/download/
and try some of these tutorials:

For non-programmers:
Non-programmer's tutorial for Python
http://www.honors.montana.edu/~jjc/easytut/easytut/
Learning To Program
http://www.crosswinds.net/~agauld/
Python Baby-steps Tutorial (crashed my NS but viewable in IE)
http://www.coolnamehere.com/z/programming/python/pythontut.asp
How To Think Like a Computer Scientist
http://www.ibiblio.org/obp/
Instant Hacking
http://www.hetland.org/python/instant-hacking.php

For those with some programming experience:
The Standard Python Tutorial
http://www.python.org/doc/current/tut/tut.html
Dive Into Python
http://diveintopython.org/

So, get back to us and let us know how it is going...

Sheila

mike_w
03-23-2001, 06:57 PM
Well, I just got my copy of &quot;Programming Python&quot;, and, it's not a book for Python newbies. It's an odd book, sort of a library reference and &quot;cookbook&quot;. For now, the online docs are proving to be much more useful to me.

I've just ordered &quot;Core Python Programming&quot;. Seems like a better text for the beginner. Right now I'm mostly interested in syntax, common libraries and Python's way of doing oop.

This is going to take me a while. Python is so different from Perl, and I've used Perl for the past 7 years. But so far I like it. The code is much more readable than Perl. It looks alot like Java, but simpler.

Tonight I'm going to install 2.0 on my machine. I already have 1.5.2, and I think I have to keep it around (I think the RedHat installer scripts use it).

Tomorrow, I'll try a simple cgi script.


[This message has been edited by mike_w (edited 03-23-01@5:59 pm)]

sheila
03-23-2001, 11:47 PM
No, the Programming Python is definitely not recommended as a beginner book. I expect mine won't come for a while, since my spouse has a book-reseller license, and he orders books ten at a time from Ingram, so I have to wait until there are nine more books ordered before my Python book will ship. :(

Oh, well, I'm too busy to read it right now, anyway. (Not that that would stop me, mind you.)

I've written two cgi scripts in Python, so far. One is just &quot;Hello, World&quot;. The other works with a form to update list settings for subscribers on one of my mailing lists. I'll probably work on it a bit more this weekend (I want to improve it).

If you're looking for other support, there is also a Python Tutor mailing list, that is just for people learning the language. I really like that list. Info here:
http://mail.python.org/mailman/listinfo/tutor

Note that FQ doesn't have Python 2.0 available (yet?). I guess the servers have either 1.5.1 or 1.5.2, depending on which server you are on. It's easy to find out, though. From a telnet prompt, just type:
$python

and walla! you're in the python interpreter, and it nicely tells you wich version you're running.

mike_w
03-24-2001, 01:27 AM
[mike@localhost mike]$ python
Python 2.1b2 (#1, Mar 24 2001, 00:09:38)
[GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
Type &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
>>>

:) :) :)

sheila
03-24-2001, 01:59 AM
Congrats on the successful, local install! :)

<added later>

OH, I see you're going for the latest (and greates?) beta release. No, I stick with the standard 2.0 install. I like my stuff as stable, and bug-free as possible.

</added later>


[This message has been edited by sheila (edited 03-24-01@01:06 am)]

GeneC
03-28-2001, 08:14 PM
I just wanted to chime in on this thread and say that there is at least one futurequest member using python in a &quot;production environment&quot;.[nbsp][nbsp]I am putting the finishing touches on a shopping cart for my wife's site www.windmillent.com (http://www.windmillent.com).[nbsp][nbsp]I used python becuase I could quickly build a shopping cart system that had the look and feel of our web site and I needed to provide easy payment links through PayPal.

I have used python for a little over a year, and perl, c, c++, java, and visual basic (among others) for about eleven years.[nbsp][nbsp]I have never found a language that lets me work as efficiently.[nbsp][nbsp]I've also found that it is very easy to teach to people who don't have a programming background (which cannot be said for either perl or c++ - I've taught both).

I would like to see FQ update to python 2.1 after it has been out for a while (and thus stable).[nbsp][nbsp]Several features (nested scopes and rich comparisons) will be very useful.[nbsp][nbsp]Python's a great language, and I'm glad to see that interest in it is growing.

Gene.

sheila
03-28-2001, 09:33 PM
Kewl. See, now there are three of us! ;)

I've got a mail script that I wrote in Python running, and a list management cgi-form that I wrote in Python here:
http://www.thinkspot.net/sheila/computers/listManagement.html
that let's subscribers to my mailing list manage their subscription themselves via the web. (I don't know what it is, but the e-mail commands for the list just seem to confuse too many people. They really seem to prefer a web interface to manage their subscriptions.)

Right now I'm working on re-writing a Python clone of cgiemail, because I'm not satisfied with some of the stuff that cgiemail does, and it is no longer under development. I have more projects lined up, when I'm done with that, too.

I've also found that it is very easy to teach to people who don't have a programming background (which cannot be said for either perl or c++ - I've taught both).
I'm teaching C++ right now, for the second time. To a class of about 18 high school students, most of whom have no prior programming experience. It isn't pretty. Well, some of them are really quick, and just cotton to programming, and have no problems. But I sure have a lot of them who are having difficulty, too. Have you taught Python in a classroom setting? (BTW, where do you teach?)


I would like to see FQ update to python 2.1 after it has been out for a while (and thus stable).[nbsp][nbsp]Several features (nested scopes and rich comparisons) will be very useful.[nbsp][nbsp]Python's a great language, and I'm glad to see that interest in it is growing.

Amen. However, Terra has indicated in other threads, that upgrading the Python version would mean overhauling the entire core, since it is embedded in the Red Hat Linux OS. I'm not sure why that need necessarily be a problem, as there are others in the comp.lang.python newsgroup who apparently have installed both on the same Red Hat machine, and they are peacefully co-existing. But, it's probably just another one of those things that I don't understand, because I'm not a sysadmin.

I think they will eventually upgrade. But if we asked for an ETA, we'd probably get an answer similar to the one here:
http://www.aota.net/ubb/Forum5/HTML/001232-1.html

GeneC
03-28-2001, 11:25 PM
A year ago I would have said that teaching c++ as a first programming language was a very good thing (and I still think so) - you would have the opportunity to present object orientation without the bagage that comes with knowing c (or other procedural languages).

I tutored students from a local college in c++ for two semesters, and I wrote and taught a course in perl for several of the people who work for me.[nbsp][nbsp]I am working with one guy now on Python, and it really seems that the language doesn't get in the way of the programming concepts in the way that it does for c++ and perl.

As far as a FQ upgrade, I can wait.[nbsp][nbsp]The primary reason that I am with FQ is that Terra and company care first about stability and second about features.[nbsp][nbsp]Part of my job is sys-admin for my company's servers.[nbsp][nbsp]On my non-production servers I am frequently testing and installing newer software, but my production servers have to be up all the time, so normally the updates I perform are security related software updates and patches.[nbsp][nbsp]Anything that threatens system stability is a no-no.

Anyway, its kind of fun to update programs that require python 1.5.2 and make them work with 1.5.1 (I have had to do this once). :)

Have you taught Python to high school students?[nbsp][nbsp]I would love to know if it works as well as I think it would.

Gene.
[This message has been edited by GeneC (edited 03-28-01@10:27 pm)]

sheila
03-29-2001, 01:47 AM
I teach the Advanced Placement Computer Science course.
(more info here: http://www.thinkspot.net/materdei/apcompsci/APCS%20Topic%20Outline.html and here: http://www.collegeboard.org/ap/computer-science/ ) This course is a preparation for an exam, so the students must be taught in the required language: C++. It can be a first programming course, and at the school where I teach, it is. But at many high schools it is a second, or even third, course. As a matter of fact, I bet most schools do not use it as a first course.

Quite a number of the schools that teach APCS and have an intro course, use a language other than C++ in their intro course. Some use Pascal, Visual Basic, Scheme, Java or other language. I think that, for a first language, the syntax of C++ is highly unforgiving. Because it is based on C, there are a lot of wierd things that actually compile, but don't do what you want them to do. The language is too big. I don't think, that having to nitpick over syntax, my students get the idea that programming can be fun and is really neat. They are thinking that some missing semi-colon at the end of a line is a big deal, when it shouldn't be. (I came from a first programming language of Pascal. OK, so I learned to program in '79, when Pascal was quite the educational language of the day. It was possible to learn the whole language in a few weeks...you can't do that with C++.)

I was thinking of introducing a new intro programming course next year at the school, and I definitely was not going to use C++ in that course. I did consider Python briefly, but ended up really being enchanted with the Teach Scheme project from Rice University. However, that is canceled for next year, now, as I've decided to leave teaching. There is an article about a high school teacher who teaches APCS and uses Python in his intro course, here:
http://www.oreilly.com/frank/elkner_0300.html

Here are some comments, made by a subscriber to my mailing list for APCS teachers:

...but I recently finished a sumer workshop on Python and was _extremely_ impressed.
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]The workshop included secondary teachers and high school students with little or no programming experiences and I was extremely impressed: by the end of the first week the students were writing programs which were comparable to a first semester final project, by the end of the second week, they were working on second semester final level projects.[nbsp][nbsp]The language's syntax is extremely easy to learn ...

I would like to see the AP CS program go to something like Python since
to me this is how to teach programming design, algorithms, event driven
and object oriented programming.[nbsp][nbsp]My students main problems in C++ were chasing down missing semicolons (or misplaced: how many of you have seen a studnet go crazy trying to find a mistake like or(i=0;i<100,i++); {...[nbsp][nbsp]can't happen in Python), matching braces, making mistakes with scope, trying to use unassigned variables, not with actual programming logic.[nbsp][nbsp]How many of you actually got to creating Objects in first year? GUI or event driven programming? ...

If I wanted to create a useful program for myself (or anyone else) I would use Python for rapid developement without questions (and I've been programming for 17 years and know about a dozen computer languages so that's no faint praise)...

At the end of the school year (last half of May), I am going to give my students three options for their last two weeks (a sort of final project...). One choice: graphics programming with the CMU library (I did this last year with the whole class, and some of them made quite impressive programs. Here is something I thought was pretty incredible, for first year students...a tetris game. (Windows executable.)
http://www.thinkspot.net/test/BTetris.exe

For the other two choices: CGI programming in C++, or learn a new language: Python. I figure, if my kids have been through a year of C++, they can pick up Python as a second language in two weeks and do something with it. Anyhow, until then, I will not know how it goes...

mike_w
03-29-2001, 03:53 AM
I'm really hooked on Python now. Over the years I've used c, awk, expect, lots of perl, lisp, Java, etc. and none of them are as easy or fun to use as Python. The syntax is so clean and simple that it allows you to focus on programming logic.

I can't go back to perl now, at least not willingly. Perl has paid my bills for a long time, but it's time for a change. No more clever hacks or obfuscated code.

Hopefully, one day I'll be able to earn a paycheck with Python.

sheila
03-29-2001, 10:37 PM
Hopefully, one day I'll be able to earn a paycheck with Python.

I would like to do that, too. However, I have a feeling I'm going to be looking for work in one of those Southern California Aerospace companies (like Boeing or Hughes or something like that...), and the chances that they will have projects being done in Python seems small to me. Probably C or C++. Eh.

If I had sufficient capital laid away, maybe I'd try freelancing or being an independent contractor or something, but unfortunately I really need to get out and get a steady paycheck.

PaulKroll
03-29-2001, 11:01 PM
Well, Perl Builder (an IDE for Perl) lists Boeing as one of their users: http://www.solutionsoft.com/perl.htm

And there's a guy with a resume that mentions his experience at Boeing, including using Python: http://www.allmanpc.com/resume_detailed.html

Unfortunately, there appears to be a Hughes (an individual) active in the Python community, making it harder to find Hughes-Python references of relevance. :)

I'd bet many of the aerospace companies would be willing to be convinced that Python was the right tool for a given job. Certainly moreso than your average generic business, where Visual Basic is still seen as the Whole World...

sheila
04-02-2001, 09:25 PM
A python sighting:
http://maps.yahoo.com/py/maps.py

clearly Yahoo is using Python for their maps pages! (They use it for their Yahoo mail, too. I even heard that Google uses Python.)

Terra
04-14-2001, 12:22 AM
Python does have it's 'methods of programming' benefits over Perl, and a much cleaner syntax...[nbsp][nbsp]I can write ugly-ugly perl code that does beautiful things - and vice versa...

I have a couple questions about Python:
1) It's speed in relation to perl...[nbsp][nbsp]If figure this will be subjective to the task at hand - but hopefully there is an average overall performance increase/decrease...[nbsp][nbsp]I would assume lugging around the OOP methodologies will impose overhead which would be pretty much unavoidable...

2) How does it stack up against Perl's regex capabilities, which I rely __heavily__ on for massive processing duties...

3) How well does it perform auto-vivication of complex data structures: e.g.:
http://www.perl.com/pub/doc/manual/html/pod/perldsc.html
**yes, I know that perl's dereferencing syntax is for masochists, but once mastered - the sadistic side shines through...[nbsp][nbsp];)

I have some projects that might fit better into an object oriented way of thinking - however I must be careful of time spent learning 'Yet Another Programming Language' since deadlines could quickly slip...

I don't think anyone can argue that Perl is **extremely** powerful and runs the full gamut of simple one-shot scripts - to system level capabilities via syscall()/POSIX interface...

Thoughts on the above?

--
Terra
--He said 'YAPL'--
FutureQuest

sheila
04-14-2001, 02:18 AM
I'm researching your &quot;speed&quot; question.

In the meantime, here's an interesting article by Guido van Rossum, about optimizing code:
http://www.python.org/doc/essays/list2str.html

sheila
04-14-2001, 02:31 AM
deleted. Can't get the URL I wanted to share to work. :(


[This message has been edited by sheila (edited 04-14-01@01:34 am)]

sheila
04-14-2001, 02:59 PM
OK, rather than delay responding, I'm just going to put down what I have so far. I've posted questions to comp.lang.python and the Python Tutor mailing list. Didn't get many responses (yet). These are FAQ and everyone gets tired of answering them.

Anyhow, here is the basic set of responses:

1) It's speed in relation to perl...[nbsp][nbsp]If figure this will be subjective to the task at hand - but hopefully there is an average overall performance increase/decrease...[nbsp][nbsp]I would assume lugging around the OOP methodologies will impose overhead which would be pretty much unavoidable...
Responses ran from: &quot;about the same&quot;, to &quot;if you were really concerned about speed, you wouldn't be using Perl&quot;. I've seen some benchmarks that seem to indicate Perl is faster, and some that seem to indicate Python is faster.

The fact that Python is object oriented does not add overhead to the language. Here is what Diedre Saoirse wrote, in response to some of your questions:

OOP is not inherently slower. Late binding is slower than early, no
question. However, python is byte compiled, which may offer speed
advantages. However, in general, if you're looking for speed, you wouldn't be using perl either.

What &quot;byte compiled&quot; means, is that once you run a python program on your machine, the interpreter produces compiled &quot;byte code&quot;, and then the next time you run it, you don't need the interpreter to interpret the code any more. It uses the byte-code instead.


2) How does it stack up against Perl's regex capabilities, which I rely __heavily__ on for massive[nbsp][nbsp]processing duties...

Python's regex modules are based on Perl5's regex features. I think that Perl has the slight advantage on speed in a regex situation. However, some wrote, that now that they use Python instead of Perl, they don't use regex near as often. Often the builtin string functions, like &quot;split&quot;, will do what they need.

Here is info about Python's regex module:
http://www.python.org/doc/current/lib/module-re.html

3) How well does it perform auto-vivication of complex data structures: e.g.:[nbsp][nbsp]http://www.perl.com/pub/doc/manual/html/pod/perldsc.html
**yes, I know that perl's dereferencing syntax is for masochists, but once mastered - the sadistic side shines through...
I didn't get good responses on this question. I think that many of the people who tried to respond to the questions, didn't know what &quot;auto-vivication&quot; is, or weren't familiar with this part of Perl. One guy said that he went to the URL you gave, but nowhere could he find the term &quot;auto-vivication&quot;.

I looked at the page briefly, and it seems to me that you are refering to an ability of being able to build data stuctures of datastructures? (Like a Hash of a Hash?) If so, Python can more than fit the bill here. You can make lists of lists, dictionaries of lists, dictionaries of dictionaries, dictionaries of classes that contain lists of dictionaries...

In response to this question, Diedre Saoirse wrote:
Python has lists and lists of lists and classes (which can contain their own members). But it doesn't have hashes, nor does it need them.
Emile van Sebille wrote:

I haven't got a clue what vivication means. ;-} Something about data structures?[nbsp][nbsp]If so, after a quick scan of the link you provided, it seems that those structures exist in python.

I think that one of the important points that several of the respondents made, was this:

If you would like readable, easy to maintain code, that you could delegate to other employees to handle, Python wins hands down over Perl any day.

Emile van Sebille wrote:

These are likely the wrong questions.[nbsp][nbsp]More to the point maybe is if your
sysadmin has *maintained* any of his perl code recently.[nbsp][nbsp]If he productively maintains code written months/years ago without problems, then he's probably right to stick to perl.[nbsp][nbsp]Even more so if other people easily read and maintain his code, perhaps allowing him an opportunity to delegate that and move forward.[nbsp][nbsp]Python, on the other hand, is an environment that promotes idioms of the obvious way of getting something done, which promotes a relatively consistent coding style and is easily learned and understood by beginners.

If you would like to see the actual responses, instead of my summary, let me know. I can e-mail them to you.

PaulKroll
04-14-2001, 05:03 PM
However, python is byte compiled, which may offer speed
advantages. How Python being compiled to bytecodes would give it a speed advantage over Perl, which is also compiled to &quot;bytecodes&quot; which are then interpreted, is beyond me.
However, in general, if you're looking for speed, you wouldn't be using perl either. That's a cop out. Speed is often not a BIG issue: if a script in Perl takes 1 minute and in Python it took 1 and a half minutes, that's really not going to be an issue most of the time. If a Perl script that runs in 1 minute takes 20 minutes in Python, that may well be an issue: and it's a possibility too. http://home.hiwaay.net/~gbacon/py-vs-pl.html (It's from 1995: I assume Python has gotten considerably faster since then. The point is that it most certainly COULD be that scale of difference, not that it IS.)

Just because someone is using a scripting language to gain productivity (programmer wise) does NOT mean the speed of the script is not an issue.

Any &quot;benchmarking&quot; by one fan or another is going to give skewed results. Any volunteers for a showdown? Set of tasks decided, fans on either side make idiomatic code to reach results, both sides time these and confirm the results are identical?

Code released to the public domain afterwards, of course. :)

sheila
04-14-2001, 05:26 PM
How Python being compiled to bytecodes would give it a speed advantage over Perl, which is also compiled to &quot;bytecodes&quot; which are then interpreted, is beyond me.
Um, you got me. I am not qualified, really, to respond to this type of remark. I have referred your remarks to the Python Tutor list. We'll see if anyone responds.

That's a cop out. Speed is often not a BIG issue: if a script in Perl takes 1 minute and in Python[nbsp][nbsp]it took 1 and a half minutes, that's really not going to be an issue most of the time. If a Per[nbsp][nbsp]script that runs in 1 minute takes 20 minutes in Python, that may well be an issue
I really don't think she was meaning to &quot;cop out&quot;. I think that the run times on Perl vs. Python scripts are close enough (for example, like your 1 minute to 1.5 minute example), that she figures, under those assumptions, that it is irrelevant. If someone needed speed, they would write the code in C, not an interpreted language. That's what she means. Usually, on the Python discussion groups if someone is saying that they really need speed in their application, it is suggested that one first right the program in Python, and then run the Python profiler on the code. This will show where the code is spending the most time. Then re-write those few lines of code in C. C can be embedded in Python (basically, you write extension modules in C and extend Python that way).

that may well be an issue: and it's a[nbsp][nbsp]possibility too. http://home.hiwaay.net/~gbacon/py-vs-pl.html (It's from 1995: I assume
Python has gotten considerably faster since then. The point is that it most certainly COULD be[nbsp][nbsp]that scale of difference, not that it IS.)
Yes, I had found that link, too. I didn't share it because, as you note, it is from 1995. That means you can't even get that version of Python any more. Here are the ones currently available:
http://www.python.org/doc/versions.html

The oldest of these (above) was released in 1996. (version 1.4)
FQ has versions 1.5.x available. Most recent, stable release is 2.0. Betas are now at 2.1.

I think that that post, by Tom Christiansen (Perl guru), may be just slightly biased and certainly out of date. Since I've been reading the Python discussion groups (mid-January), it seems that Python and Perl are both in the same ball-park on execution time. Sometimes I see &quot;benchmarks&quot; posted, that indicate one or the other is three or four times faster than the other one. But then someone comes along, and critques the code that was used for the comparison and when the code is re-written, performance times are much closer.

Just because someone is using a scripting language to gain productivity (programmer wise) does NOT mean the speed of the script is not an issue.
Shoot. I certainly didn't mean it that way, and I'm sure Diedre didn't either. Please take it in the context, that Perl and Python have performance times that are in the same ballpark, and that if speed were of the utmost importance (overshadowing other criteria), then one would choose a language like C. Of course, this would slow down development of the program, as well. There are always trade-offs.

Any &quot;benchmarking&quot; by one fan or another is going to give skewed results. Any volunteers for a showdown? Set of tasks decided, fans on either side make idiomatic code to reach results, both[nbsp][nbsp]sides time these and confirm the results are identical?

[nbsp]Code released to the public domain afterwards, of course.
Whew. Well, I love a good contest. But who, besides lil' ol' me, is gonna volunteer to be the Python advocate? See, the problem is, I'm just a newbie, and not really schooled on the performance issues. Hmm. I suppose people on the Python Tutor list, or the comp.lang.python newsgroup *might* help me tune and optimize my code.

I will be interested to see the responses to this *challenge*. Who else is interested in participating? Who else is able to write Python code? What task would be proposed?

--waiting and wondering and watching...

sheila
04-18-2001, 02:42 AM
Terra,

I have found something that looks like a reasonable comparison of different languages (including Perl and Python) under a limited set of testing circumstances:

http://wwwipd.ira.uka.de/~prechelt/Biblio/jccpprt_computer2000.pdf