Why should I switch to Python?

Harry George hgg9140 at george.org
Sat Apr 1 18:48:44 EST 2000


Of course, read the language comparisons.  But what you seem to be
seeking is personal experiences, so here is another one:

For 3 years I've written perl code.  1 LOC, 10 LOC, 100 LOC, 1000 LOC,
and larger.  It revolutionized our group's productivity and I got
several other people interested.  I made a point of timing projects
with a stopwatch (27 minutes from notion through rqmts, spec, code,
alpha, beta, and implementation is my personal best).  We also did
code reviews with at least 1 experienced perl-ist in the review --
this was valuable in improving community coding skills.

I noticed that people who wrote in it all the time did ok, but if you
go away (e.g., code in lisp, prolog, C, C++, Java), and come back, you
forget the rules for stuff like references.  I was spending a lot of
time helping people maintain code they originally wrote but could no
longer understand.  Personally, I write as maintainably as I can
("-wt", "use strict", subset of available syntax, etc.), but even I
was getting lost on references.

Then I did a multi-module, OO project with several thousand lines.  It
was heavily into references and overrides and hashes inside of arrays
inside of hashes.  I survived it, but was ready for another approach.
So I redid it in python.  It took a couple weeks to catch on to some
of the idioms, but the result was fewer files, fewer lines of code
total, and vastly more maintainable.  Among other things, I could see
the forest for the trees, anc changed some algorithms.

HOWEVER: It ran slower than the equivalent perl code.  Is this
important?  Not for my task, where the difference is roughly 2 seconds
vs 1 second.  Profiling showed a lot of that was in reg expr tasks, so
I'll see what 1.6 does.
 
I found python didn't support perl-ish idioms, some of which are very
succinct and just plain cool.  So I wrote pyperl and cgipm.  With
those in hand, python gets the perl idioms but still has python's
robust syntax.

Next, I started porting java apps (e.g., XML and database stuff) to
python.  Again, dramatic improvements in LOC, development time, and
maintainability.

These days, I still write perl and java where required by work
conditions, but use python where permitted.  Unfortunately, I've
managed to "sell" perl to several managers (who have invested in
sending their people to classes), and they aren't happy that I'm now
pushing something else.


Aaron Turner <aturner_ at _pobox.com> writes:

> A friend of mine is trying to convince me we should 
> do a project using ORBit in Python.  I've been 
> coding Perl for over 3 years and really like it.  
> (Especially it's syntax and ability to grok my 
> programming style.)  Now, I understand the Perl
> vs. Python war and everyone has their preferred
> taste in the matter.  
> 
> What I'd like to hear from people is what technical 
> resons I should switch to Python.  Are there any 
> features that Python has (perhaps in it's OO 
> offering) that Perl lacks?  From what I can tell
> people tend to prefer Python over Perl mostly
> for its syntax, which I find very likable.
> 
> Thanks.

-- 
Harry George
hgg9140 at seanet.com



More information about the Python-list mailing list