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

Paul Prescod paulp at ActiveState.com
Mon Jun 18 14:41:17 EDT 2001


Kirk Strauser wrote:
> 
>...
> 
> If you already know C or a similar language, then yes, Perl is easy 
> to read.

Whatever Perl's virtues, it is a massive stretch to claim that it is
C-like.

I have done about a decade of C programming and probably about 4 years
of Java and I don't see how that helps me with this:


sub import {
    $^H |= $utf8::hint_bits;
    $enc{caller()} = $_[1] if $_[1];
}

sub unimport {
    $^H &= ~$utf8::hint_bits;
}

sub AUTOLOAD {
    require "utf8_heavy.pl";
    goto &$AUTOLOAD;
}

Just because it uses curly braces and semicolons???? This isn't some
weird example I made up. I picked a random Perl file from the Perl
distribution. I suspect that less than 1 in 20 Perl files looks
substantially like C.

> Or at least, it can be when written by someone who considers
> "maintainability" to be an important goal.  It's unfortunately easy to
> create Perl that is totally, utterly, completely unreadable - do a Google
> search for "obfuscated perl contest" and take a look at some of the winners.

That's a separate issue. Perl's syntax is radically larger than and
different than C or Java. My experience is that an understanding of
those languages is of very limited help in understanding Perl. The code
above isn't obfuscated. It is idiomatic. But the only C keywords I see
above are "if" and "goto" and both are used in a manner that is not
legal in C. Furthermore, Perl's semantics are even more radically
different than C (if that's possible). C is strongly, statically typed.
Perl is weakly, dynamically typed. C has no OO. Perl does. C++ and
Perl's OO models are not even roughly similar.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list