Why should I switch to Python?

Tom Culliton culliton at clark.net
Sat Apr 1 22:28:01 CEST 2000


In article <secfidq8921 at corp.supernews.com>,
Aaron Turner  <aturner_ at _pobox.com> wrote:
>In article <00033120055300.03687 at quadra.teleo.net>, Patrick Phalen <python-list at teleo.net> wrote:
>Yeah, I found those before I posted (as well as reading the archives of
>this group on deja news).   Honestly I found them for the
>most part very lacking in technical information.  Mostly things like:
>
>- Perl code is ugly, Python code is easy to read
>- Python was OO from the start, Perl's OO was a bolt on
>
>But things like this aren't particularly useful in trying to determine
>which language gets the job done better.  Code readibilty has 
>historically been a human problem which is solved with coding
>standards set for the programmers IMHO.   So I'm more interested in 
>things like:

Calling readability a "human problem" begs the issue, some languages
encourage readble code and discourage unreadble code while others make
it almost painful to write stuff that makes sense a few days later.

This issue is especially critical given the statistical trusim that
half of the people developing code have skills which are below
average.  I'll go further and say that about 70-80% just want to get
through their day without putting out anymore effort than absolutely
necessary.  A language that still makes it possible for this segment
of the community to produce maintainable code is an enormous win.

In my experience Python is such a language, and Perl most definitely
is not.

>- What is the impact of Python's OO being there from the start?
>- Does it perform better?
>- Is it significantly easier to use?  
>- More powerful/support features that aren't in Perl yet?
>
>Honestly the more I reasearch, the more it seems that it's purely 
>a matter of taste.  If you like Perl, there's nothing inherient about
>Python that makes it better.   Sorry if this just sounds like a troll, but
>I'm really trying to get a feel about something I know nothing about 
>from personal experiance.

You're dismissing subjective arguments ("easy to read") in one breath
and then asking subjective questions ("significantly easier to use")
in the next.  Do you honestly want to be convinced or are you just
looking for rationalizations not to switch?

>Basically if you know both languages, and were planning a mid-sized 
>project, why would you choose Python?  It's hard to take my friend
>seriously in his evaluation when he says he'd rather do this project
>in C++  than in Perl (especially when he doesn't know Perl).

We choose Python after doing a survey of "scripting"/VHLL languages,
with Perl, TCL, Scheme, and Python being the main contenders.  We also
looked at (and continued to look at) a variety of less well know
options.  Going into the evaluation we had strong backgrounds in C,
C++, shell, awk, ... and substantial experience with all of the better
known languages but Python.  Python still won going away.

Perl was slightly faster but was just too cryptic and made it too hard
to write maintainable code.

TCL was smaller, a bit easier to extend/embed, and had tools like TK
and Expect, but was just too slow, only really had two types (strings
and lists od strings) and didn't catch typos that the Python compiler
yelled about right away.

Scheme was... well... scheme.  Lisp fans to the contrary it just
wasn't for us.  It didn't have the libraries of modules we needed, we
got lost in the parenthesis even with the editors help, ...  Scheme is
a beautiful elegant powerful expressive language, but it just isn't
most peoples cup of tea.

Python was a delight.  At first we all pulled faces at the significant
whitespace, but it grew on us since it enforced uniform layout.  The
libraries and builtin types were a treasure chest, the syntax clean
and elegant, the support for OOP amazingly straight forward.

The documentation was generally excellent, written with a clarity and
lucidity which would put most native speakers to shame. ("This guy is
Dutch?  He writes like Brian Kernighan." (We'd all been struggling
with Bjarne's 1st edition a bit too long.))

We were intrigued.  We grew enthusiastic.  We became rabid fans.

There were things that we still wished for, more speed (but it was
fast enough), the ability to do more static type checking (none of the
langauages on our short list really provided this though), the ability
to do more stringent encapsulation, ...  But in practice we seldom
found these to be real problems.

You can teach the basics of Python to someone in an afternoon.  I've
done it many times.  After getting past the inital resistance to
learning something new, people with programming experience seem to
"get it" amazingly fast.  There are remarkably few puzzled or pained
looks, and many smiles of delight.  The enthusiasm grows quickly,
especially when you show them things like a full blown multi-user chat
server in a page of easily understood code, or a utility of roughly
the same size and clarity to do DB to DB transfers without fighting
with dump formats and the like, or when they whip together a clean
solution to some otherwise difficult problem on their own in a couple
hours.

THIS is why the buzz about Python is on the verge of becoming
deafening.

Try it for a week or two.  Do some small projects or utilities with
it.  Read a couple of the tutorials and the examples in the Lib, Demo,
and Tools directory.  You'll probably still find your self doing quick
hacks in perl, but you'll probably also find yourself seeing your
friends point.



More information about the Python-list mailing list