Re: Python's future bright?

Robert S. Thau (rst@ai.mit.edu)
Fri, 25 Jun 1999 17:26:58 -0400 (EDT)


Jeff Bone writes:

Just for fun, I'll try a compare and contrast to current Perl releases.

> Me personally, after repeatedly blasting Python ("any language whose
> whitespace has semantic value is fundamentally flawed,")

NB that this is more than an aesthetic issue, even if your editor and
python never disagree about where you put the tab stops; it makes it
difficult and awkward to mix Python and other languages in the same
file. (So, for instance, replacing Java with JPython in JSP is harder
than it ought to be because you have to think about how you handle the
indentation in control-flow constructs which span multiple Python
inclusions).

> * it's actually just as if not more portable than Java
> * being both embeddable and extensible is nice

ditto Perl.

> * having a standard externalization scheme is nice

There are widely-used modules for Perl which provide the basic
facility of giving you an importable hunk-o-bytes (though I'm not sure
I like using the ones which write Perl code anywhere that I'm not
guaranteed via signatures that no one else will muck with it). I'm
not sure if there's anything directly comparable to Python "shelves"
in the usual bag-o-tricks, however.

> * the ability to "freeze" / dump standalone executables is nice

Don't think Perl does this in any standard way.

> * it's amenable to formal techniques that allow compilation
> * higher-order functions

Ditto Perl, and...

> There's still some weirdness with scoping rules, some semantic
> sloppiness in how functions are *really* dealt with, and the standard
> implementation is far from optimal, but I suspect all that will get
> better with time.

... the language situation has improved enormously since Perl 4.0 with
regard to all these issues; it now has genuine lexical variables and
higher-order functions, with no ifs ands or buts.

With that, I'm almost willing to say that anything Scheme can do, Perl
can do better. Almost. The problem is that Perl uses reference
counting for most of its storage management, with all the pathologies
that entails; however, this weakness is currently shared by Python.

> I too much prefer Scheme from a language purists standpoint, but this is
> just another case of the philosophical struggle between having many ways
> to do something in a language and having a minimalist language in which
> there's generally a single "obviously correct" solution. I don't know
> why that struggle exists, maybe because people don't really want to sit
> and reason about their code, they'd just rather test and tweak until it
> works. ;-)

In terms of feature sets, I'd rate Perl and Python as more or less
equivalent, and Scheme as somewhat impoverished by comparison (though
it does get some things right in the scoping department which Python
doesn't). The deciding factors for me are the size of the user
community, CPAN, and that the evils of Perl's syntax have been lesser,
in my experience, than those of Python. (I've commented more than
once that Perl code looks like a program in some other language that
was left at the bottom of a chicken coop, but once you're used to the
chicken droppings, I find they get in the way less than the Python
equivalents, and the perspicacity of Perl regex and substitution
syntax is... bracing).

That's my opinion. Your mileage may vary, void where prohibited, do
not attempt to use as a condiment or floor wax.

rst