Switch from perl to python?

Elf M. Sternberg elf at drizzle.com
Mon Dec 16 11:40:20 EST 2002


Sorry, coming in late, and something Roy said (about someone else) icked
me:

Roy Smith <roy at panix.com> writes:

> elechak at bigfoot.com (Erik Lechak) wrote:
>> Why should I use python rather than perl?
>> (I like perl so saying that the syntax of python is superior to perl
>> isn't an argument to get me to change.)

> The biggest reasons I like python over perl are:

> 1) syntax (had to say it)
> 2) object orientation
> 3) interactive (I can just fire up an interpreter and type stuff at it 
> to test ideas; building it with gnu readline support makes it even that 
> much more convenient).

        The (nameless) company I work for produces "network operations
center appliances", which means rackable boxen that one sticks into a
rack, wires up an ethernet connection, and it "just works."  After our
version 1.0 release, we decided to switch to using a single scripting
language for all functionality that was not absolutely performance-bound
(for that, we use C and assembly).  The language chosen, not without
controversy, was Python.

        There are a lot of good Perl coders here, as well as those with
experience with Bourne, Awk, and Tcl, as well as the token Scheme and
Ruby fanatics (one each).  Buy Python was chosen because the cleanliness
of the syntax guaranteed that the next generation of programmers and
maintainers would be able to figure out what the heck was going on in
any piece of code without having to re-write the whole thing.

>> Are there any benchmark comparisons between python and perl?

> Lots of them, try a google search.  Which is faster depends a lot on 
> what you're doing, but if I had to put a number to it, I'd guess that 
> Perl is typically faster by about a factor of two.  I consider that 
> completely inconsequential for most purposes.

        I've found that the Python-to-C interface much easier to write
to than the Perl-to-C interface, and I've written quite a bit in both.
If you need compiled-code performance, a good profiler and SWIG are your
friends.

>> Are python threads fully functional?

> Not sure what you mean by "fully functional", but I suspect the answer 
> is "yes".

        The answer is "yes."  If you're coming from a Java environment,
synchronization issues may bite you.

>> What are python's shortcomings?

> From an adoption point of view, the indentation issue is probably the 
> single biggest thing which turns people away.  You just have to get over 
> it.  We've got a guy here (hot-shot C++ type) who insists he'd try 
> Python, but can't get past the indenting issue.  His loss.

        This it the one that bugged me.  Roy, doesn't your hot-shot C++
type already have an indentation habit?  If not, I would worry about how
"hot shot" he really is.  Indentation has become the preferred method,
in many languages, C derivatives most definitely, of highlighting
expression blocks and scope.

                Elf



More information about the Python-list mailing list