Python version of IQ has been updates (IQ v0.34.python)

Alex Martelli aleaxit at yahoo.com
Tue Jun 19 09:40:46 EDT 2001


"Kirk Strauser" <kirk at strauser.com> wrote in message
news:87k829ai6y.fsf at pooh.honeypot...
>
> At 2001-06-18T08:59:32Z, "Alex Martelli" <aleaxit at yahoo.com> writes:
>
> > For regular expressions, they're extremely similar, and both VERY
> > hard-going for a beginner.
>
> Alex,
>
> I would compare that to "Mathematica's nonlinear equation solvers are VERY
> hard-going for non-mathematicians."  Perl's RE syntax is designed by and
for
> people who have pretty much mastered the subject elsewhere.

And where would that "elsewhere" be?  Once upon a time, you could
perhaps count on "a real programmer" having a lot of experience
with vi and/or emacs, lexx, grep, egrep, sed, awk -- today, while
still widespread and flourishing, these tools are not mainstream.
Python and Perl are, but I'd bet that today, for *most* Python and
Perl users, the language in question is likely to be their first
(and maybe their only) real exposure to RE's.  *VERY* hard-going.


> > Outside of regular expressions, I do not think anybody would claim
Perl's
> > concise syntax is anywhere near as easy-to-read as Python's clean and
> > spare one.
>
> I would.  Then again, I'm more experienced with C, C++, Java, and other
> similar languages.

More experienced than whom?  I'm a Brainbench MVP for C++, I have
about 17 years' experience with C, and I am reasonably familiar with
Java.  However, I hope I would never make the widespread mistake
of confusing what is *FAMILIAR* with what is *INTRINSICALLY* clear
and easy to read.

> You can write C in Perl if you feel comfortable with it.

Not really, since for example in Perl all your variables need
a leading '$' which C does not require (unless in a certain
case you need a leading '@' instead to get vector context rather
than scalar context -- either will be syntactically accepted
and they will do subtly different things -- how utterly far we
are already from C's rough simplicity, and it's just the start...).


> > > Can perl be compiled into byte code for faster startup or put into a
stand
> > > alone application? Or is Perl strickly an interpreted language?
>
> > Both:-).  You can *buy* "Perl compilers" (e.g. from ActiveState
> > and IndigoPerl -- are there others?) that are roughly equivalent
> > to what you can do with the free py2exe and McMillan's "install"
> > for Python.
>
> They are also similar to the `perlcc' command that ships with Perl 5.005
and
> higher.  Specifically, perlcc generates C source that, when compiled, acts
> exactly like the original Perl.

Is the Perl 5.6 manual page wrong, then?  It says:
"""
The whole compiler suite (`perlcc' included) should be considered very
experimental. Use for production purposes is strongly discouraged.
    ...
Bugs in the various compiler backends still exist, and are perhaps too
numerous to list here.
"""
It wouldn't exactly give me a warm fuzzy feeling to rely on something
"very experimental", whose "use for production purposes is strongly
discouraged".  But maybe it's just a case of obsolete docs?


> > > Of course you can port IQ to Perl if you want, but in any case (perl,
> > > python, rebol, arexx) it'd be nice to incorporate into IQ, the ability
to
> > > access files thru the internet in a way that is as simple as accessing
a
> > > file on the system you are using IQ on.
>
> > If you use Python, that's trivial -- just open the URL string with
> > urllib.urlopen, exactly like you would open a filepath string with the
> > builtin function open, and you'll get a file(-like) object ready for
> > reading through all the usual fileobject methods (.read, readline, etc
> > etc).
>
> Same with Perl.  Use the appropriate class, create a URL-fetch object,
then
> execute it.  Read the results just like any other filehandle.

It's not quite the same, if you need to do three steps in one
case and one in the other, although it's no doubt close.


> Perl and Python are roughly equivalent from my understanding.  However,
it's

The sheer power of the two languages is indeed fully comparable.
This is put in stark relief by one of the very few empirical
studies of programming,
http://wwwipd.ira.uka.de/~prechelt/Biblio/jccpprtTR.pdf
which used Rexx, Tcl, Java, C and C++ as well as Perl and Python.

Totally-unusable programs among those submitted were 1 in 14
for Perl (vs, e.g., 3 of 8 for C); Python was the only language
of the 7 for which all submitted programs were usable (0 of
14 unusable).  Running times of submitted Perl and Python
programs only differed with p=0.15 (well below any statistical
significance).  Program length, all quality measures, and
productivity measures, were all similar between the two
languages to well within statistical significance.  It's a pity
that in most analyses the author, Lutz Prechelt, bracketed
Python and Perl together with Tcl and Rexx, which, as the
detailed measures show, were _significantly_ slower, bigger
and less productive than either P-language.  Even WITH this
bracketing, overall, 'Script' shows up very well against C/C++,
and even better against Java.

It's interesting that the two P-languages arrive at roughly
similar power by such widely divergent paths.  Python's way
is simplicity, cleanliness, directness: no special-cases, no
ad-hoc context-dependent behavior, ideally "just one obviously
right way to perform any given task" (as an ideal, to be sure,
not an actual _fact_:-).  Perl's is overflowing superabundance
of constructs, subtle context-dependence, TMTOWTDI.  They
cover roughly the same 'ecological niche', yet their 'survival
strategies' appear to be opposites on most points.

> my opinion that Perl is much more well-supported, with massive amounts of
> online documentation and available help.

It's true that "Perl documentation" gives 524,000 google hits
while "Python documentation" only gives 160,000; I guess us
poor Pythonistas will have to be content with reading those
160,000 pages -- let's see, at one page a minute, that's...
111 days (no time off for sleeping or eating, of course).

The Perlites will be able to keep reading for 363 days at the
same hectic pace.  But then, it's only fair -- to reach just
about the same power *DOES* take about 3.27 times less study
and work in Python, after all:-).

As for help, all I've noticed on comp.lang.python were
ex-Perlites amazed at how hard we try to HELP new would-be
Pythonistas -- nary a "go read the FAQ you jerk" or "that's
a CGI question, go ask it elsewhere!" in sight... it may
be that the Perl newgroups have vastly changed since I
last was a regular there, and that now it's all sweetness
and light, but that would sure amaze me.  Besides the NG,
there's the direct help 'hotline', help at python.org, plus
tutor at python.org for those who are specifically trying to
learn (or teach) programming itself (using Python as the
first programming language -- since it gets its power
through simplicity, Python is as suitable as one's first
programming language as it is as, say, the thirteenth:-).


Alex






More information about the Python-list mailing list