Switch from perl to python?

Ken Seehof kseehof at neuralintegrator.com
Sat Dec 14 05:43:02 EST 2002


At 08:52 PM 12/13/2002 Friday, Erik Lechak wrote:
>Hello all,
>
>For years I have been using perl as my language of choice for most
>tasks.  And perl has been up to the challenge.  I recently downloaded
>python and started to tinker with it.  I like what I see. I am almost
>convinced to devote the time to make python my language of choice. I
>am about ready to start a new project where both perl and python would
>work.
>
>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.)

Are you sure?  You should ask yourself, "Can I understand code that
I wrote 6 months ago?"  Or, "Can someone else read it?"  If you
answered no to the first question, you might consider switching. On
the other hand, if you answered no to the second question, stick with
perl; you will have much better job security :-)

>Where is python's equivalent to CPAN?

Good question.  Here's a discussion about it:
http://www.seapig.org/PythonDoesntNeedCpan

I'm in favor of anything that improves my ability to find more tools.  So
far, I've had pretty good luck finding what I'm looking for.  I use a
combination of http://www.vex.net/parnassus/, Google, and the search
engine at http://www.python.org.  Distutils solves the standardization
of installation problem.

There's a sig about this topic.
http://mail.python.org/mailman/listinfo/catalog-sig

>Are there any benchmark comparisons between python and perl?

Yes, lots of them.  The best one I've seen is the Language Shootout:
http://www.bagley.org/~doug/shootout/

I think Roy's estimate of 2 to 1 in favor of Perl is a bit high, (unless
you are doing pretty much pure text processing).  Actually Python
and Perl are very close (conveniently they are alphabetically close
as well :-)

Python is slightly better on memory footprint and Perl is slightly
better on speed (maybe +20% on average).  Both differences are
negligible IMO.  If it isn't negligible, you should be coding in C.

Interpreting benchmarks is somewhat subjective anyway, since
you don't necessarily know what benchmark your application is
similar to.

>Are python threads fully functional?

Unfortunately the standard thread module in the standard distribution
does not support true multiprocessing threads).  If you are using
threads for I/O purposes, etc, they work fine, and have all the usual
features.  There are also multiprocessing libraries available, and there
is plenty of work being done to make python better in this regard.

>How active is python development (interpreter, modules)?

Very.

>Are pythoners actually interested in the parrot(perl6) interpreter?

Well, the merge with Java (JPython) was a success.  I have no
doubt that Parrot will be a reality too.  Google "python perl parrot"
gets 7000+ hits.  I even wrote a video game about it for a 48 hour
video game competition:
http://www.neuralintegrator.com/snakes

>What are python's shortcomings?

1. Mainly speed (not usually a big deal if most of your time is spent
inside library calls anyway).  Not a huge difference from perl here.

2. Some (mostly non-python programmers) consider the lack of
declarations to be a major weakness because certain kinds of
incorrect code are permitted.  However, I have very rarely actually
encountered difficult bugs associated with this "flaw".

3. The indentation rule causes silly people to waste enormous
amounts of time discussing irrelevant issues.  If it weren't for all
these stupid discussions, python style indentation would probably
increase programmer productivity overall.  See now you got me
started.  I'm supposed to be programming, but I'm talking about
indentation instead. If I weren't a python programmer I'd be done
by now :-)

4. Guido's foolish refusal to add all of my brilliant ideas to the
language.

5. Lack of a world peace library.  This shortcoming could render
all of pythons strengths irrelevant.  The "hello world" sample program
just isn't good enough, but it's a start.

>Can I distribute a reliable python/GUI application without including
>the source (not interested in obfuscation or source filters)?

Sort of.  You can distribute .pyc files (python modules compiled
into bytecode).  This will work against anyone who is not a python
internals expert.  Unfortunately the bytecode can be decompiled,
and due to pythons introspective nature, can also be reverse-
engineered.  There are tools that can merge your program and
modules into an executable file, but still the bytecode is in there
somewhere.

If bytecode is good enough for you, then the answer is yes, and
it is very easy to do (just release your modules as pyc).

Since you mention GUI, you should look at wxPython.  It's my
favorite (you have many excellent python GUI options available
to you).  http://www.wxpython.org/

>Thanks,
>Erik Lechak
>--
>http://mail.python.org/mailman/listinfo/python-list

- Ken Seehof - kseehof at neuralintegrator.com






More information about the Python-list mailing list