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

Alex Martelli aleaxit at yahoo.com
Tue Jun 19 12:59:52 EDT 2001


"Kirk Strauser" <kirk at strauser.com> wrote in message
news:87g0cwqxzu.fsf at pooh.honeypot...
>
> At 2001-06-19T13:40:46Z, "Alex Martelli" <aleaxit at yahoo.com> writes:
>
> > "Kirk Strauser" <kirk at strauser.com> wrote in message
>
> >> Perl's RE syntax is designed by and for people who have pretty much
> >> mastered the subject elsewhere.
>
> > And where would that "elsewhere" be?
>
> College, for starters.  I had a solid grip on RE's before I ever met Perl.

Well, so did I, but that's because I was programming long before Perl
was invented, and I _happened_ to use Unix systems (where RE's were
widespread).  I've worked with people of huge experience who spent their
professional lives on such operating systems as DEC's and IBM's and
never truly "mastered RE's":-).

> Note that I'm not asserting that *my* experience implies similar results
for
> anyone else.

No, but you did state that the RE syntax (that Perl and Python more
or less share) IS designed for people who have already "pretty much
mastered the subject elsewhere".  This may be true, but in that case
it underlines the existence of a problem.  Not that I can think of
any easy solution, mind you:-).


> >> Then again, I'm more experienced with C, C++, Java, and other similar
> >> languages.
>
> > More experienced than whom?
>
> You read that wrong - the proper question is "more experienced than at
> what?", to which the answer would be myself at Ada, FORTRAN, Lisp, ML,
etc.

Oh, that.  Yes, I, too, had more experience with C and C++ (not Java yet:
it had not been invented at that time), when I met Perl, than with the other
languages you list (with the possible exception of Fortran, which I
DID use rather extensively -- not quite as much as C, but, by that
time of my life, more than C++, which was still rather young and
unstable, although clearly an 'emerging language').

> Perl was comfortable to me because of my particular background.  I picked
it

Funny, since our backgrounds seem similar, yet, while I did use
Perl extensively and productively, it never was *comfortable* to me.

The idea of not being able to easily build complex data structures
(we're talking of times well before Perl 5!-), for example, made me
just as uncomfortable as it did in Fortran -- yeah, yeah, I used
all the usual workarounds and kludges, but it was UNcomfortable to
say the least:-).

> up because 1) it's what we use at the office, and 2) for whatever reason,
it
> was an easy step for me.

Oh, I know very well why *I* picked it up -- at the time, I was
not aware of any real alternative (awk came "close, but no
cigar", and I had not heard about Python yet -- I don't think
it had yet been published on Usenet, or if it had it must have
escaped my notice at the time).  It surely beat sh in terms of
speed, functionality, etc (don't even get me STARTED about those
black souls who write scripts in *csh*...!-).


> >> 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...
>
> I understand what you're saying, and I wouldn't hope to imply that Perl is
> exactly like C.  However, the following (working) code snippet should be
> transparent to the casual C coder:
>
>         $seconds = time();
>         printf("%d seconds since the epoch!\n", $seconds);
>
> Sure, there are fundamental differences, but a non-Perl coder could
probably
> maintain the lines above if they had to.

If the original author had the discipline to stick to such
constructs, eschewing all idiomatic Perl, then, maybe.  I
_think_ any Perlist would probably write
    printf "$seconds since the epoch!\n";

I guess the equivalent Python code might be found to have
less surface similarity to C:

    import time

    seconds = time.time()
    print "%d seconds since the epoch!"%seconds

given the 'import' and the %-operator for the substitution
(the ending semicolons are optional, but it's definitely NOT
idiomatic Python to use them, and I don't think it makes
sense to use a language in strongly anti-idiomatic ways).


> Honestly, Alex, I never meant to disparage Python in any way.  Although I
> haven't personally used it, people I trust claim that it's a great
> language.  I just happened to have a lot of Perl experience, and someone
> asked a question for which my answer was "try Perl!".  I respect that your
> answer is different, just as mine may very well be in the future.

I think I understand you well, and thanks for the clarification.

I might probably have said "try Perl" myself just a couple years
ago (I *did* use Perl for a huge morass of scripts to run some
very serious computational tasks, with significant success -- but
I think those thousands of Perl lines were what finally broke my
Perl tolerance forever... *thanks be* I found Python then!-).


Alex






More information about the Python-list mailing list