syntax philosophy

Tuang tuanglen at hotmail.com
Wed Nov 19 00:03:23 CET 2003


Kirk Strauser <kirk at strauser.com> wrote in message news:<873ccm78f3.fsf at strauser.com>...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> At 2003-11-17T21:29:16Z, tuanglen at hotmail.com (Tuang) writes:
> 
> > In Python, apparently you have to first remember to declare your
> > dictionary outside the loop:
> >
> > histogram {}
> 
> Note that you have to declare:
> 
>    my %histogram;
> 
> outside the loop in Perl if use want it to be "use strict"-safe.  And you
> *do* want that, don't you?

Actually, I don't, so your point is a good one. I occasionally build
something big enough in Perl that "use strict" matters (me:"What? Perl
CGI is the only platform available?", them:"Yep. Take it or leave
it"), but that's not my preferred use for Perl. My preferred use is
when I encounter some data in one form and I want to quickly process
it into another form with about two minutes of work and less than ten
lines of code. Sort of like using a particularly powerful
sed+awk+grep+sort+... all rolled into one utility. I don't want to
have to set things up. I just want to tell it what I want and have it
take care of the overhead (declaring variables, initializing them to
zero, taking care of memory, etc.)

I was hoping that Python would be just as easy to use in that role AND
scale better to larger programs. I'm convinced that it will scale
better, but there is apparently a rather small but still real cost in
inconvenience at the "one-liner" level.




More information about the Python-list mailing list