[ale] intro to python for the experienced programmer

Benjamin Scherrey scherrey at innoverse.com
Thu Feb 14 14:30:29 EST 2002


How do I do this without starting a language war? Well - here goes....

First off, if you're hard core into text processing then Perl is very likely what you want to 
use. Python has pretty strong support for this as well but is a more general purpose 
language so it will never be as fully optimised for this type of task as Perl which is really 
focused on that one issue. That said, you've got to be a pretty good Perl programmer to 
be able to take advantage of some of that optimization and, my experience is that its very 
rarely worth dealing with the downside to justify pushing that barrier so far.

Python is available on as many platforms as Perl. Its a much more elegant language 
whereas, to do much useful in Perl requires you to deal with a lot of "exceptions" and 
learn too much of the internals of the interpreter than I think is appropriate. Finally, Perl 
just isn't readable, no matter how good a programmer you are. Its a domain specific 
language that is extremely difficult to maintain over the long haul. People generally just 
add more code to it as it lives rather than design an architecture which can evolve 
cleanly. Python enforces a lot of concepts within the language (unlike Perl) without tying 
your hands (like java). Its very easy to learn and maintain. Actually its probably the easiest 
language to maintain that I've ever run into which means a lot when you examine the 
lifecycle of a software application's costs. Probably the only things its missing that would 
prompt me to move to it as my majority language (over C++) is templates and seperate 
interface declaration/compilation units. My biggest complaint with Python is that it loses a 
bit of its elegance by being too wordy (although not as bad as java) - and a Perl coder will 
suffer from this effect more than most. Also, I really dislike its standard gui library, Tinker, 
which is Tk-based (a language that I loath) but, fortunately, you can easily do without it 
and PyQt is coming along nicely if you need a good gui library (even though its not part of 
the standard). I think one of Perl's biggest attractions is that CPAN resource out there. 
Fortunately Python has something similar although not quite as externsive. Its nice to see 
that there are freely available libraries out there that let you connect and interface with 
just about any major product/tool that exists.

Finally, to be quite honest, I never had an overwhelming reason to use Perl other than its 
was available and appropriate for a few tasks I needed done. That regulated it to a basic 
scripting tool for me. My company, on the other hand, has developed some of the most 
extensive Perl-based application code I've ever seen and it performed pretty well. It just 
can't be maintained well by anyone but the originators and even then its difficult. Python 
equivalents for general application code are far more elegant, somewhat more efficient 
(except in the aspects of Perl's text handling domain), and much easier to grasp to both 
outside users and new developers. I think for scripting, it generally takes me about two 
lines of code extra to make my scripts in Python rather than Perl. A cost I easily justify.

	Hope that helps and that I haven't offended the Perl-folks out there -
		
		Ben Scherrey


2/14/2002 1:22:35 PM, Jeff Hubbs <hbbs at attbi.com> wrote:

>Ben -
>
>Can you elaborate on your perspective w.r.t Python vs. Perl - i.e., 
>what, for made Python a "replacement" for Perl for you?  I have an 
>interest in both languages.
>
>- Jeff




---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list