Why should I switch to Python?

Steve Holden sholden at bellatlantic.net
Sun Apr 2 14:51:32 EDT 2000


Tim Peters wrote:
> 
> [Aaron Turner]
> > ...
> > Basically if you know both languages [Perl & Python], and were planning
> > a mid-sized project, why would you choose Python?
> 
> When I was very young, I wondered why my dad's electric razor didn't rip his
> face to shreds.  As a budding empirical scientist, I tested my theories by
> trying it first on my cheek, and then on my tongue.  This was very
> educational -- although it's still painful to talk about <wink>.
> 
Gives a whole new meaning the the phrase "smooth talker"!

> In other words, "voice of experience".  There aren't a lot of bilingual P
> programmers out there, but I expect you'll find the majority of them hanging
> out on c.l.py rather than c.l.p.m.  That should tell you the conclusion
> you're likely to reach if you decide to become one of them too.  Nobody is
> going to argue you into it, though, and Python is easy enough to learn that
> there's no significant barrier against just giving it a try.
> 
Seems that generally Pythonistas, at least from the evidence of newsgroups,
currently tend to have significantly better social skills than are found
on "other newsgroups".  My own blunders have been met with patient nudging
which gave me a chance to see the error of my ways.

> From what I've seen-- which matches my own experience --people generally
> switch over gradually.  The prime motivation seems to be that, time after
> time, when tracking down a bug in a Perl program, you increasingly realize
> "hmm -- if I had written this in Python, this wouldn't have happened".
> Whether it's the 200th time you've been shredded by an array-vs-scalar
> context surprise, or the 12th time an implicit coercion guessed the wrong
> way, they're traps you *can't* fall into in Python.
> 
Again speaking personally, I gave up Perl long before I took up Python, and
this was one of the major reasons.  I had inherited a collection of Perl-
scripted web sites, and maintenance was a real pain.  Boy, was I glas when I
left that job.

Perl's avowed intention that everything which *might* mean something in
the language *should* mean something makes the odds much higher that an
incorrect program won't be caught until execution.  This means that for
a learner much more time has to be spent testing code to find out just
how Perl interprets what *has* to be regarded as a pretty grotty syntax.

As for the OO extension, maybe I'm just a purist, but I found Perl's
exposure of the whole mechanism just a little too rich for my taste.

> Python's syntax is simpler, its semantics more regular, and its philosophy
> of raising exceptions is "gripe whenever there's a reasonable doubt" rather
> than "assume the programmer meant whatever they wrote".  These conspire to
> make larger Python systems less work over the long haul, and especially in a
> team project (TMTOWTDI loses its cowboy charm when you have to decipher 6
> other peoples' code every day too).
> 
Agreed.  The exception mechanism is a major win for Python, and it encourages
much more extensive error checking in the average Python program.  It's much
cleaner, and that makes programs shorter, safer and more comprehensible.

> > 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).
> 
> Depends on the project.  I make my living these days on a project that's
> about a half million lines of C++ and assembler -- Perl and Python are both
> too fat and slow to have much use in it apart from automating testing.  Perl
> gets used a lot for the latter, but other groups where I work, with large
> projects that can afford the fat of either P language, all use Python now,
> or Java + JPython.  There's no company policy on this, it's a group-by-group
> decision.  And despite that we now have many more lines of Python than Perl,
> I still spend most of my "help others debug their scripts" time staring at
> Perl.
> 
> a-day-of-experience-is-worth-a-decade-of-usenet<wink>-ly y'rs  - tim

regards
 Steve
--
"Bulding information systems just because it's fun."
Steve Holden  sholden at bellatlantic.net  703 716 7275



More information about the Python-list mailing list